LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-01-2007, 06:15 PM   #1
hammertime1983
LQ Newbie
 
Registered: Mar 2007
Posts: 15

Rep: Reputation: Disabled
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,
 
Old 11-01-2007, 06:29 PM   #2
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Rep: Reputation: 30
man ls

Specifically look at -S & -r
 
Old 05-24-2013, 01:13 PM   #3
jhumkey
LQ Newbie
 
Registered: May 2013
Posts: 4

Rep: Reputation: Disabled
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.
 
Old 05-27-2013, 02:38 AM   #4
bloodstreetboy
Member
 
Registered: May 2012
Posts: 195
Blog Entries: 3

Rep: Reputation: 37
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
Is it possible to set the udp packet size for a DNS query in BIND 9.2.1?? Paul_Randle Linux - Networking 0 10-17-2005 08:29 AM
file system size larger than fysical size:superblock or partition table corrupt klizon Linux - General 0 06-18-2004 04:18 PM
How to list total file size of a directory phil1076 Linux - General 3 12-18-2003 03:47 PM
rpm query size? lf412 Linux - Newbie 3 03-04-2003 12:52 AM


All times are GMT -5. The time now is 05:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration