View total disk usage

Disk free space can be checked in the Linux command line using the df and du commands. df stands for disk free. du stands for disk usage. The -h flag stands for human. It shows the sizes in human readable formats like MB or GB instead of bytes.

1
2
# Show total disk usage
df -h

Disk usage by folder

The s flag stands for sum. It shows the total space taken by the current folder including its sub-folders.

1
2
3
4
5
6
7
8
# Show disk usage of current folder including sub-folders
du -sh

# Show disk usage of specified folder
du -sh folder-name

# Show disk usage of sub-folders in the current folder
du -h --max-depth=1