Tuesday, June 29, 2021

Linux du Command - One of Simple Terminal Command

In daily IT administrator works, sometimes, we will check the free space of some server disks/storages.

First we do by using df -lh command, and then we will get the informations about all disk partition sizes.

If it occurs a small available space in a disk partition, we should check where the largest directory/folder that has the large size.

After search the tools for inspecting the summary of some directories size, I've found du command.

It works very fast in calculating some directories/folders size.

Just open a terminal then direct to root or a directory that you want to know the size. 

Then just type : du -sh

It will show the summary of  the root or a directory sizes.

If you want to get the directories list with all the size : du -sh */ | sort -hr

If you want to get list of files size, type : du -ah


-a : all files

-s : summmary

-h : human readable (K/M/G Byte)


Thank you...




No comments:

Post a Comment