« How trackable is your browser? | Main | The daftness of data caps »

The Linux command line is immensely powerful, especially if you combine it with handy popup access from an application like Yakuake, but sometimes you just want to know what string to type without having to wade through screens of man pages. That's what this occasional series is about.

(As always, you can type man <command_name> for full details about a command.)

df - Disk free space
Show disk usage and free space:
df

Show disk usage and free space in "human-readable" format (like 1K, 10M, 4.2G):
df -h

Show disk usage and free space in "human-readable" format but using powers of 1,000, not 1,024 (just like disk drive manufacturers do when quoting the sizes of their drives!):
df -H


du - Disk usage
Show file space usage in the current directory:
du

Show file space usage in the current directory in "human-readable" format:
du -h

Show file space usage in your home directory:
du -h ~

Sort usage to display the largest files last:
du -h | sort -n

Summarise the current directory's usage:
du -sh

Summarize usage by all level 1 sub-directories (not sub-sub-directories, etc.):
du -sh *

Show the file space used in /usr/share/icons:
du -sh /usr/share/icons/

Summarise the file space used by all sub-directories in /usr/share/icons:
du -sh /usr/share/icons/*

Show the size of all sub-directories in your home folder:
du -sh ~/*



Any more useful ones? Leave a comment!

Previous Hidden Linux
Next Hidden Linux


Comments

Using the period/full stop is also useful with 'df'. For example 'df -h .' displays disk usage and free space only on the current partition.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Subscribe
Newsletter & SubscriptionsPC World is New Zealand’s top selling computing and technology magazine.

It provides up-to-the-minute editorial, insight and buying advice for personal computing, cell phones, game consoles, digital entertainment and broadband.
SIGN UP
PCWorldUpdate
PC World's weekly round-up of tech news, gear and game reviews, software selections, and handy How Tos.