How to view disk space and directory space usage in linux shell

Disk space usage on current system

In the linux shell, type:

df -h

Which should produce an output similar to:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda               20G  2.9G   16G  16% /
none                  246M     0  246M   0% /dev/shm

the -h parameter indicates human readable sizes (with sufixes K,M,G)

Disk space usage over directories

Too see space usage of the current directory ( recursively ), type:

du -h

Which should produce an output similar to:

4.0K    ./autohandlers
4.0K    ./gen/template
8.0K    ./gen
4.0K    ./handlers
28K     .
Linux Shell / Bash Scripting, Tutorials | Posted on June 29, 2013 by .

About Kristijan Burnik

Kristijan Burnik is a Programmer and Web Developer specializing in Server-side and Client-side Technologies and Application Development on Linux Servers and Windows Desktop . Also has experience in Networking, Desktop application development as well as Android mobile application development . Experienced in Programming Languages like Java, C, C++, C#, PHP, Javascript, MySQL and somewhat in other languages like Bash, Perl & Python. Sometimes he works as a Graphical Designer for digital production as well as for printing and advertising. He dedicates his spare time writing Tech Articles on his blog in order to share his work with others, as well as to document his projects for his own use. He's also an Educator & Mentor in field of Algorithms and Programming to young programmers in Zagreb, Croatia.

Leave a Reply