-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 the Largest Folder and Subdirectoriesį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. you might want to display the largest files in KB, MB, or GB. Some of you would like to display the above result in a human-readable format. (In our case, We displayed the first 5 lines). head : Output the first part of the files.-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 the top biggest directories under /home partition. How to Find Biggest Files and Directories in Linux Master the ‘Find’ Command with these 35 Practical Examples.Learn 10 Useful ‘du’ (Disk Usage) Commands in Linux.If you want to learn more about these two commands, then head over to the following articles. This brief tutorial describes how to find the largest files and folders in the Linux file system using the du (disk usage) and find commands. It is very necessary to find unnecessary junk and free it up from your hard disk. As a Linux administrator, you must periodically check which files and folders are consuming more disk space.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |