List LS query by file size
Hello,
I was wondering how I could list an LS query by the file sizes, i.e. smallest file to largest file... Thanks, |
man ls
Specifically look at -S & -r |
Sort by Size with ls
ls -lSr | tail -10
Is very useful . . . [jhumkey@holmes etc]$ ls -lSr | tail -10 -rw-r--r--. 1 root root 51287 2010-11-10 06:41 dovecot.conf.rpmnew -rw-r--r--. 1 root root 51291 2010-05-23 14:41 dovecot.conv.orig.jkh -rw-r--r--. 1 root root 51348 2010-06-15 14:16 dovecot.conf.jkh -rw-r--r--. 1 root root 51348 2012-07-29 15:53 dovecot.conf -rw-r--r--. 1 root root 69097 2010-07-22 11:23 php.ini -rw-r--r--. 1 root root 131314 2009-09-18 07:35 Muttrc -rw-r--r--. 1 root root 144184 2010-04-15 04:52 lynx.cfg -rw-r--r--. 1 root root 149261 2012-07-01 12:22 ld.so.cache -rw-r--r--. 1 root root 634392 2009-09-08 01:55 services -rw-r--r--. 1 root root 644755 2013-05-23 03:32 prelink.cache To . . . l -> display Long listing with filesizes S -> sort by Size r -> Reverse the sort order (biggest files to bottom) | tail -10 -> Show only the last (biggest) 10 files in the directory. |
Great !!!
If you want to know the difference between ls -s & ls -S Read this. http://www.rapidtables.com/code/linux/ls/ls-s.htm or If you want to know the difference between ls -r & ls -R Read this. http://www.rapidtables.com/code/linu...-r.htm#reverse |
All times are GMT -5. The time now is 12:12 PM. |