When administrating Linux systems we can found us tracking disk usage. Linux uses different partitions to store data. There are some temp files located in /tmp or different paths. Some applications are installed into the /opt path. So managing paths and disk usage may become hard in Linux. There are some GUI applications like KDirStat but they are useful for only GUI environments. We will look different commands in this tutorial to get disk usage.
Get Disk Usage With df
We can simple issue df command and get disk usage in Kilobyte like below
Get Disk Usage With df Human Readable Format
Let’s make it more readable by using gigabyte output. We will provide
-h which means human readable format.
$ df -h
Information like Size, Used, Available or Usage percentage are printed in more readable format
Get Disk Usage With df As Megabyte Format
If you like the old days by out size with megabyte use below command.
$ df -m
Getting Usage With ncdu
ncdu is text-based disk usage viewer which can be found in Fedora,Ubuntu, Debian distributions. Sadly it is not provided by CentOS default repositories.
$ sudo ncdu /
- We need root privilege to scan all root directory
And here after running ncdu we get following screen.
How To Get File System Disk Usage In Linux? Infografic