Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Wednesday, May 12, 2010

Number of files and folders in a Linux folder

Recently I transfered a folder with big a mount of archives and something seemed to be missing, obviously I wanted to verify that the amount of files was correct and probably just like you, I couldn't find a simple Linux command to help me with this, in fact I found crazy commands like:

"echo $(($(ls -l | grep -v ^d | wc -l)-1))"

Until I found the simple and elegant "tree", if you don't have it already just run a simple:

"sudo apt-get install tree"

And then you'll have the simple response you were looking for:

"234 directories, 1786 files"

Monday, August 17, 2009

Removing old Linux Kernels

After a couple of years using Linux as my main operative system I noticed that the size occupied in the hard was growing and growing with each upgrade, also my grub list was including more and more kernel options that I don't use anymore so I decided to remove old kernels to "clean" a bit my hard drive.

First you should check your current available kernel version with this command:

"uname -r"

You will get a reply similar to this one:

"2.6.27-9-generic"

Open "Synaptic" package manager and search for "linux-image" and after scrolling down you'll find options similar to this:

linux-image-2.6.24-21-generic
linux-image-2.6.22-14-generic

Remove kernel versions you are not using anymore, in my case I decided to keep the current one and the previous one just in case I need it.

Just make sure you don't remove the current version otherwise you'll have a long week ;)