JP Vossen on 20 Apr 2016 09:26:55 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Good tools to assay disk usage in linux


Or `man find` and look for "-printf", like:
	find . -printf '%M\t%u\t%g\t%t\t%s\t%p\n'
	find . -printf '%s\t%p\n'

If you want to do time stuff, you need to put %T before each time element, which confused the heck out of me for a while. Like:

# "CCYY-MM-DD HH:MM {tab} size {tab} path" sorted by path:
find . -type f -printf '%TY-%Tm-%Td %TH:%TM\t%s\t%p\n' | sort -t'<TAB>' -k3,3

Need to replace <TAB> with a real tab character...

On 04/20/2016 11:57 AM, Gavin W. Burris wrote:
Nice.  You can get rid of awk:
alias bigfiles='find . -ls |sort -rn -k7 |head -10'

Usually, I just use this for the current dir:
alias sizes='du -s * .[a-zA-Z0-9]* -c |sort -n'

Here's a fancier one, cli bar graph included:
alias bars='du -x --max-depth=1|sort -rn|awk -F / -v c=$COLUMNS '"'"'NR==1{t=$1}NR>1{r=int($1/t*c+.5); b="\033[1;31m"; for (i=0; i<r; i++) b=b"#"; printf " %5.2f%% %s\033[0m %s\n", $1/t*100, b, $2}'"'"'|tac'

Cheers.


On Wed 04/20/16 11:19AM EDT, Andy Wojnarek wrote:
I use:

Andrews-MacBook-Pro:/ root# find . -ls 2>/dev/null | awk '{ print $7 " " $NF }' | sort -rn | head -5
5706997760 ./Users/awojnarek/Downloads/VMware-OpenStack-2.0.0.0-3717954_OVF10.ova
3438788608 ./System/Library/Caches/com.apple.coresymbolicationd/data
1315634608 ./Library/Updates/031-53822/OSXUpd10.11.4Patch.pkg
1150844928 ./Users/awojnarek/sft/ubuntu-15.04-desktop-amd64.iso
1073741824 ./private/var/vm/sleepimage

I like using find command, it’s quicker than du.


Thanks,
Andrew Wojnarek |  Sr. Systems Engineer    | ATS Group, LLC


On Apr 20, 2016, at 11:14 AM, JP Vossen <jp@jpsdomain.org<mailto:jp@jpsdomain.org>> wrote:

I used to use `du -hl <various>` a lot until I found `ncdu` which is a curses-based CLI tool.  The awesome part is that it walks the tree first, then you can navigate around instantly, to see what's what.  It's in the repos for Debuntu-like systems.

`man ncdu` and see "-x" and  "--exclude-caches" also.


If that doesn't work, here are some other clues:
http://dev.yorhel.nl/ncdu/
* gt5 - Quite similar to ncdu, but a different approach.
* tdu - Another small ncurses-based disk usage visualization utility.
* TreeSize - GTK, using a treeview.
* Baobab - GTK, using pie-charts, a treeview and a treemap. Comes with GNOME.
* GdMap - GTK, with a treemap display.
* Filelight - KDE, using pie-charts.
* KDirStat - KDE, with a treemap display.
* QDiskUsage - Qt, using pie-charts.
* xdiskusage - FLTK, with a treemap display.
* fsv - 3D visualization.
* Philesight - Web-based clone of Filelight.


On 04/20/2016 10:56 AM, Michael Lazin wrote:
I often use "du -sh ./*" to see what directory in a webspace uses the
most space.  This will list the size of each directory you are in in
human readable format.  If you want something fancier let me know.  I
can probably point you in the right direction.

On Wed, Apr 20, 2016 at 10:54 AM, Paul Walker <pjwalker76@gmail.com
<mailto:pjwalker76@gmail.com>> wrote:

    Looking for good command line tools for assaying disk usage. I'd
    like to be able to crawl the disk down to an arbitrary depth and
    output the size of each directory. I don't really want to write too
    much bash in the process! Any good goto tools you could share?


Later,
JP
--  -------------------------------------------------------------------
JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug