[olug] Unix Tip: LISTING FILES BY SIZE

Mike Peterson mpeterson at mail.charlesfurniture.com
Fri Mar 14 20:26:11 UTC 2003


You can also shortcut the time sort on UNIX and LINUX with

ls -lt | more and
ls -lrt | more for reverse time order

----- Original Message ----- 
From: "Mike Hostetler" <thehaas at binary.net>
To: "Omaha Linux User Group" <olug at olug.org>
Sent: Friday, March 14, 2003 1:34 PM
Subject: Re: [olug] Unix Tip: LISTING FILES BY SIZE


> On Fri, Mar 14, 2003 at 11:25:43AM -0800, Unix Guru Universe wrote:
> > LISTING FILES BY SIZE
> > 
> > 
> > If you want to have a listing of the 
> > files sorted by size, you can use the 
> > following command(s), it will list 
> > the files in decrease order. if you 
> > need to do the same thing recursively,
> > you could use the second one.
> > 
> > ls -l | grep ^- | sort -nr -k 5 | more
> > 
> > ls -lR | grep ^- | sort -nr -k 5 | more
> > 
> 
> On Linux (and others using GNU's ls) it's even easier:
> ls --sort=size -l |more
> 
> To sort by how old the files are, you do this:
> ls --sort=time -l |more
> 
> (most recent files are first)
> 
> You can change the time to "mtime" or "atime" with "--time=atime", etc.
> 
> Yes, I have spent some time reading the manual page for ls . . . 
> 
> -- mikeh
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug




More information about the OLUG mailing list