Check Disk Space in unix servers by Commands line

unix

On the internet you will find plenty of tools for checking disk space utilization in Linux. However, unix has a strong built-in utility called ‘df‘. The ‘df‘ command stands for “disk filesystem“, it is used to get a full summary of available and used disk space usage of the file system on unix system.

Unix family of operating systems offer the following commands to check disk space usage as per your needs.

Check disk space on Unix operating system

Unix command to check disk space:

  1. df command – Shows the amount of disk space used and available on Unix file systems.
  2. du command – Display disk usage statistic for each directory on Unix server.

How to display Unix disk usage statistics

See disk usage for all files in the current directory. Run:

du -a

To get the disk usage of a directory tree and each of its subtrees for /home/dataparadise, enter:

du /home/dataparadise

However, it is possible to see outout 1024-byte blocks if you pass the -k switch, enter:

du -k /home/dataparadise

Want to see total disk usage of a directory tree? Try:

du -s /home/dataparadise

248088 /home/dataparadise

One can summarize disk usage for a specific directory as follows:

du -hs /home
1.4G /home

Getting help about du command

Try running the following man command or see online man page here:

man du
whatis du

How to display free disk space info on Unix

To view the amount of free space in the file system, try df command:

Display a grand total

Pass the -c option:

df -c

Some version of Unix operating systems can display output in human readable format. In other words, Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte:

df -H

See df command man page here or by typing the following command for more info:

man df

You May Also Like

Avatar

About the Author: [email protected]