The linux du
command displays the size of file space used by the specified files or folders. If the specified path is a directory (folder), du
summarizes disk usage of each subdirectory in that directory. Otherwise, du reports the disk usage of the current working folder.
To get the total size of the /srv folder, use following linux command:
root@byrev:/home# sudo du -sh /var
Result
root@byrev:/srv/SAMSUNG-850-PRO/MOST-RECENT# sudo du -shc /srv
15T /srv/
15T total
where arguments is:
- s – Display only the total size of the specified folder, do not display file size totals for subfolders.
- h – Print in a human-readable format (kb, mb, gb, tb)
to get a report about the disk usage of the 1st-level subfolders is to use the –max-depth option:
sudo du -h --max-depth=1 /srv
Result
2.2T /srv/SEAGATE3-8T
12K /srv/ftp
6.1T /srv/SAMSUNG-8T
5.8T /srv/SEAGATE2-8T
172G /srv/SAMSUNG-850-PRO
4.0K /srv/HGST-4T
15T /srv
to print sorted, only the top 10 folders:
root@byrev:/# du -h /usr/ | sort -rh | head -10
Result
4.1G /usr/
3.0G /usr/lib
1.1G /usr/lib/x86_64-linux-gnu
656M /usr/lib/modules
582M /usr/lib/firmware
347M /usr/share
320M /usr/lib/modules/5.4.0-90-generic
320M /usr/lib/modules/5.4.0-89-generic
311M /usr/src
272M /usr/lib/modules/5.4.0-90-generic/kernel
Leave a Reply
Your email address will not be published. Required fields are marked *