Tips & Trick Check Disk Space

Tips & Trick Check Disk Space

On this tips & trick we will discuss how to check disk space usage on a linux machine. Sometimes we need information on how much disk space we have used and how much free. And also we need information which file or directory  is big and where it is. This information we need to easily manage our disk space usage.

Tips & Trick Check Disk Space

Here are some commands we can use to check disk space usage on Linux machines

[root@nodesg08 ~]# du -Sh /home/ | sort -rh | head -20
The above command show 20 largest data in the home folder

[root@nodesg08 ~]# du -h –max-depth=1 /home | sort -n -r
The above command show largest data in the home folder

[root@nodesg08 ~]# find /home -type f -exec du -Sh {} + | sort -rh | head -n 20
The above command show 20 largest file in the home folder

[root@nodesg08 ~]# du -h /home –max-depth=1|grep G|sort
The above command show data with Giga size in the home folder

[root@nodesg08 ~]# du -h /home –max-depth=1|grep M|sort
The above command show data with Mega size in the home folder

[root@nodesg08 ~]# find /home -xdev -type f -size +100M -exec du -sh {} ‘;’ | sort -rh | head -n50
The above command find and show files in home folders that are over 100M in size

Noted: For the location of the directory please adjust to your needs

Please explore du command for your needs

[root@nodesg08 ~]# du –help

Some cause full disk space

  1. Errors logs, please check the error to fix,
  2. Backup file, it is advisable to perform external backup. If internal backup please routinely delete data that is not used or download and store in safe place,
  3. The use of uncompressed images,
  4. Storing unneeded data,
  5. Etc.

 

Good Luck

Add a Comment