![]() Finding the biggest files and folders is no big deal. The above command will display the largest file from /home/tecmint/Downloads directory. ![]() # find /home/tecmint/Downloads/ -type f -printf "%s %p\n" | sort -rn | head -n 5 If you want to display the biggest file sizes only, then run the following command: # find -type f -exec du -Sh + | sort -rh | head -n 5 -h : Compare human readable numbers (e.g., 2K, 1G).sort command : sort lines of text files.-s : Display only a total for each argument.-S : Do not include the size of subdirectories.-h : Print sizes in human-readable format (e.g., 10MB).To display the largest folders/files including the sub-directories, run: # du -Sh | sort -rh | head -5įind out the meaning of each option using in above command: If you feel that some directories are not important, you can simply delete a few sub-directories or delete the entire folder to free up some space. The above command will show the top directories, which are eating up more disk space. i.e you might want to display the largest files in KB, MB, or GB. Some of you would like to display the above result in human-readable format. (In our case, We displayed the first 5 lines). -r : Reverse the result of comparisons.-n : Compare according to string numerical value.sort command : Sort lines of text files.Let us break down the command and see what says each parameter. If you want to display the biggest directories in the current working directory, run: # du -a | sort -n -r | head -n 5 The above command displays the biggest 5 directories of my /home partition. Run the following command to find out top biggest directories under /home partition. ![]() How to Find Biggest Files and Directories in Linux
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |