INFORMATICS

The Best

Check Disk Space Usage on CentOS

Inicio desactivadoInicio desactivadoInicio desactivadoInicio desactivadoInicio desactivado
 

Check Disk Space Usage on CentOS

Most commonly used commands for checking disk spaces or usage or free spaces are df, du and free

df command is used to get the details disk spaces information of the file system. DF - stands for disk filesystem.

df --help

–help is the common option for any command to get all information for using the command.

df -h

-h option is used with df command to display the disk space in human readable format. Disk space value will be shown in GB and MB.

df -m

-m option is used with df command to show the disk space in MB.

df  -T

-T option is used with df command to show the file type.

df -h Public

You can show the disk space information of any particular folder in human readable format by using above command. The output will show the disk space information of Public folder.

df -hT

You can use two options -hT together to get the file types in human readable format.

 

Another useful command to find out the usage information is all files and folders. Here, du stands for disk usage. This command retrieves information of folders and sub-folders and files recursively. So, this command can be used to get more detail information of disk usage. 

 

du -h

The output will show the size information of files and folders in more human readable format.

du -h Downloads

The output will show the size of Downloads folder.

du -h --time Downloads

The output will show the size of Downloads folder with last modification time.

du -m Downloads

The output will show the size of Downloads folder in MB.

 

 

free command is used to get the detail used and unused information of the computer memory and swap. 

 

free

The output shows the memory and swap usage information in byes.

free -h

The output shows the memory and swap usage information in GB and MB.

free -m

The output shows the memory and swap usage information in MB.

 

 

One of the mostly used built-in tool to monitor the partition of the disk is fdisk. Using this tool you can not only monitor the disk partition but also create, move, copy and delete disk partitions. You must have root privilege to run this command. 

 

sudo fdisk -l

-l option is used to get information about all available partitions on your operating system. You have to provide root password to run this command.

sudo fdisk -l /dev/sda1

You have to mention the device name with –l and fdisk command for getting the information of specific partition or device.

sudo fdisk /dev/sda1

You can print the output of any device by executing fdisk command with device name. When you will run the command, a prompt will appear to take the next command if the device name exists. Type ‘p’ to print the output.

 

Search