Bobr.pw - Бобровая сила

I have already considered the issue of Analyzing how much space is occupied on the hard disk.(in Windows), on Unix\Linux this is something else, the console rules the ball there and the more you communicate the more convenient it becomes. Today I want to tell you about one of the ways to quickly find what is occupied space on the disk.

du - a standard Unix utility stands for disk usage - a standard Unix program for evaluating the occupied file space. Ancient as a mammoth:)

It is better to start with the team:

du --max-depth=1 -h /

where: 

--max-depth=1 - limits the level of nesting , it is not necessary to start with all all files and folders at once, it is better to localize the most voluminous ones.
-h - output in human readable form, megabytes. kilobytes and so on.
/ - well, this is just the analysis directory in this case , the root directory of the system

Basically everything. You can feed the output to the sorting utility and get an ordered list with the following command.

# du --max-depth=1 -h -m / | sort -n -r

Where:

-m - output of the occupied space in megabytes with rounding to an integer, i.e. if you have 52 kilobytes in the output it will be 1 megabyte
-n - indicates to the sort utility that the first column is digits
-r -  is the reverse of sorting , I prefer to see the largest directories first and start cleaning them

the result will be as follows:

1967 /
1111 /usr
533 /var
178 /boot
64 /home
39 /etc
29 /run
15 /root