Basic Linux commands Part 2: Storage and disk information

Part 2 in the Basic Linux commands; How to view storage space details and information such as free space on Linux, Part 1 was Navigation, folders and files.

Viewing disk information

Primarily this is done using the Disk file system command df

To view the system disk information in a human readable format (KB, MB, GB and TB) use

df -h

To view as MB use

df -m

View file system types

df -T

Folder sizes

Disk usage (du) can be used for directory sizes

View the current directory size in a readable format summary

du -sh

Or you can specify directory

du -sh directory/foldername

To include 1 level of sub directories in size most to least:

du -h --max-depth=1 | sort -hr

You can change the 1 to 2 or 3 to dive deeper into sub directories.