09-25-04 07:50 AM
Nithya Venkatachalam wrote:
> Hi,
> Is there anyway to list a set of files in a directory whose size is
> greater than some value?
> Or to display in sorted order by size? Any UNIX command?
> Nithya
>
Don't forget, 'ls' means 'list sorted' anyway ;-)).
Hence, it should not be too complex to take the files'
sizes, rather than their names, as the sorting criterium...
For ex., on the Linux system I'm typing this, ls is
$ LC_MESSAGES=C ls --version
ls (fileutils) 4.1
Written by Richard Stallman and David MacKenzie.
(...)
i.e. the GNU implementation.
The resp. manpage reveals
-S sort by file size
ad libitum to be combined with
-r, --reverse
reverse order while sorting
Voilà, as for the 2nd question.
For the 1st one: In one of my scripts, I use the line
find /var/spool/news -type f -size +10k -not -name '.overview' -ls | \
sort -k 7,8 -n | uniq -c -w 67 >~/Log.size.news
Again, the '-ls' option to 'find' is a GNU speciality AFAIK.
[But you weren't specific about the particular Unix / Unixoid system
you asked for. And IMHO, this question would have been more suitable
to c.u.questions or c.u.shell.]
Juergen
[ Post a follow-up to this message ]
|