How to find smallest and largest directories and files in linux
How to find smallest and largest directories and files in linux. Commands to know: there is no single command to find the largest directories and files. However, we can use some combination of commands to achieve this task. 1. du -a | sort -n -r | head -n 10 du -ah | sort -n -r | head -n 10 - human readable format. it shows files in ascending order Where, du : Disk usage command that estimates file space usage -a : Displays all directories and files sort : 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 10 : Print the first 10 2. du -ah /var/log | sort -n -r | head -n 10 to show file sizes in ascending order in /var/log in human readable format 3. Let us find out the largest files in the current working directory and its sub-directories: find -printf '%s%p \n'...