🐧 Linux / Shell Scripting
Beginner
How do df and du help with disk usage?
Answer
df (disk free) reports filesystem-level disk space: total, used, and available. df -h shows human-readable sizes (GB, MB). df -hT also shows filesystem types. du (disk usage) shows the space consumed by files and directories. du -sh /var/log shows the total size of the log directory. du -sh * | sort -h in a directory lists and sorts all items by size — great for finding what is consuming the most space. A common sysadmin task when a disk fills up: df -h to find the full filesystem, then du -sh /* and drilling down to locate the large files.
Previous
How do ps and kill work for process management?
Next
What is top or htop and how do you use it?