Posted by: Ian | July 30, 2008

Linux – Finding out how much space a directory is taking up

One annoying thing with using command line Linux is remembering all the switches of each command. More often than not I know the command can do what I want it to, but I can’t remember the switches.

One such task is trying to find out how much space a directory takes up. Whilst doing a ‘du’ is fine it does return back a lot of info i don’t want to know about.

Recently I wanted to know what space each of the directories under /usr was taking up. In this instance ‘du’ by itself is useless as it returns the size of everything.

Here is the command which I use to get a total size for each folder under /usr (Make sure you are already in /usr)

du -h -s *

This will return all the directory sizes under /usr and return them in Human readable format.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Categories

%d bloggers like this: