Du Sort By Size
As a Linux administrator, you must periodically check which files and folders are consuming more disk space. It is very necessary to find the unnecessary junks and free up them from your hard disk.This brief tutorial describes how to find the largest files and folders in the Linux file system using du and find command. If you want to learn more about these two commands, then head over to the following articles.How to Find Biggest Files and Directories in LinuxRun the following command to find out top biggest directories under /home partition. # du -a /home sort -n -r head -n 5. Find Biggest Directories OnlyLet us break down the command and see what says each parameter. du command: Estimate file space usage.
a: Displays all files and folders. sort command: Sort lines of text files.n: Compare according to string numerical value.r: Reverse the result of comparisons. head: Output the first part of files.n: Print the first ‘n’ lines. (In our case, We displayed first 5 lines).Some of you would like to display the above result in human readable format. I.e you might want to display the largest files in KB, MB, or GB. # du -hs.
Ubuntu Du Sort By Size
sort -rh head -5. It appears that if you use -h (human readable) with du, the sort gets confused as it doesn’t interpret the decimal unit prefix (i.e. The G, M, or K) properly, and you get the largest displayed numeric value.For example: 9G, 10K, 8K, 4M, 7G would sort to 10K, 9G, 8K, 7G, 4M.I noticed this when I got the following results: # du -h /data.source/ sort -n -r head -n 51020K /data.source/modtile/default/9/0/0/1/1761020K /data.source/modtile/default/10/0/0/1/1781016K /data.source/modtile/default/11/0/0/35/65996K /data.source/modtile/default/9/0/0/16/170992K /data.source/modtile/default/9/0/0/1/160# du /data.source/ sort -n -r head -n /data.source/597114072 /data.source/pgsql597114068 /data.source/pgsql/9. /data.source/pgsql/9.6/data595032120 /data.source/pgsql/9.6/data/base.
Du Sort By Size
- Mar 19, 2013 I have a large number of files stored in /Downloads/ directory. How do I sort and print sizes in human readable format using du -h command under Ubuntu Linux LTS version 12.04 or any other Linux distributions? You can pass the -h or -human-numeric-sort option to the sort command to sort.
- But if quota is not enabled on the partition, I am using the following simple command to get the list of subfolders sorted by their size: du -max-depth=1 /home/ sort -n -r If this is really big, as it often is, you might want to direct the output of the command to a file, and check back later in a few minutes when it is finished.
Du Command In Linux Sort By Size In Gb
I have a large number of files stored in /Downloads/ directory. How do I sort and print sizes in human readable format using du -h command under Ubuntu Linux LTS version 12.04 or any other Linux distributions? You can pass the -h or -human-numeric-sort option to the sort command to sort.
Comments are closed.