[chiglug] fyi: list top 10 largest open files
Freddy Martinez
freddymartinez9 at gmail.com
Mon Jan 4 23:52:26 UTC 2016
Often I find myself sorting disk use using du -sh * but it doesn't properly
handle Mb, Gb, Kb for historical reasons. So there is an alias I use often
called duf
alias duf='du -sk * | sort -n | while read size fname; do for unit in k M G
T P E Z Y; do if [ $size -lt 1024 ]; then echo -e
"${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done'
Try it out.
On Mon, Jan 4, 2016 at 5:45 PM, Drew Fustini <pdp7pdp7 at gmail.com> wrote:
> I thought this was nifty:
> https://plus.google.com/+CybercitiBiz/posts/M35xwuzfvcM
>
> Want to list top 10 largest open files on a Linux or Unix like system? Try:
> lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB" " " $9 " " $1
> }' | sort -n -u | tail
>
> _______________________________________________
> discuss mailing list
> discuss at lists.chicagolug.org
> https://lists.chicagolug.org/mailman/listinfo/discuss
>
--
Freddy Martinez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.chicagolug.org/pipermail/discuss/attachments/20160104/221d183a/attachment-0002.html>
More information about the discuss
mailing list