LWN.net Logo

My sysadmin toolbox (Linux.com)

Adam Williamson, Mandriva employee and amateur systems administrator looks at a few of his favorite tools. "My first tool is htop. Most Linux users, when they first wanted to find out what was eating all their CPU time, were taught about top. Top tells you what processes are running and how many resources they're using ... in just about the most unfriendly way possible. Htop does exactly the same thing as top, but is much less likely to induce migraines."
(Log in to post comments)

My sysadmin toolbox (Linux.com)

Posted Feb 24, 2006 22:00 UTC (Fri) by sbergman27 (guest, #10767) [Link]

I guess Filelight is OK. But for filesystem house-cleaning, I've never found anything better than good old:

# du -ak / | sort -nr | less

This gives you all the files and directories on the system, in descending order by size. Directories are listed along with files and show the total blocks in the subtree under them.

Basically, it gives all the objects (files and directories) in descending order by size.

du -ak | sort -nr | less

will start in the directory you are currently in.

du -akx | sort -nr | less

will restrict it to the current filesystem.

Simple, but very effective.

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 0:01 UTC (Sat) by jwb (guest, #15467) [Link]

No reason why you can't employ both methods, assuming you have an X11 terminal. I use filelight when I remember to and du otherwise, but my preferred command is slightly different from yours:

du -s * | sort -n

I usually start in /home to find the user with the most space, then cd to that user and find his biggest directory, etc etc etc.

My only complaint about filelight is its dependency on KDE.

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 9:44 UTC (Sat) by NightMonkey (subscriber, #23051) [Link]

Perhaps you'd like Baobab? http://www.marzocca.net/linux/baobab.html

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 15:32 UTC (Sat) by johill (subscriber, #25196) [Link]

Similarly, there's GD Map: http://gdmap.sourceforge.net/
Judging from the screenshots it seems that its layout algorithm is a bit smarter than baobab's.

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 20:29 UTC (Sat) by sbergman27 (guest, #10767) [Link]

Perhaps someone could extend the Doom administration tool: http://www.cs.unm.edu/~dlchao/flake/doom/

to handle filesystem housekeeping. ;-)

My sysadmin toolbox (Linux.com)

Posted Mar 6, 2006 23:49 UTC (Mon) by pepekraft (guest, #27332) [Link]

I like "xdu" -- http://sd.wareonearth.com/~phil/xdu/

it's pretty old now, but I haven't found a newer one that I like better.

it parses du output and displays clean simple gui

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 15:02 UTC (Sat) by Baylink (subscriber, #755) [Link]

I've always been partial to

# du -a / | sort -rn (| less)

though I *have* always wanted a way to get du to only show *file* sizes, not directories, and I don't know that even GNU du knows how to do that.

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 17:38 UTC (Sat) by sbergman27 (guest, #10767) [Link]

Not a one-liner, but I think:

du > /tmp/dirs.tmp
du -a | cat - /tmp/dirs.tmp | sort -nr | uniq -u

will get you close.

Empty directories will still get reported, but all at the very bottom with the very smallest files.

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 18:00 UTC (Sat) by jwb (guest, #15467) [Link]

why not this?

find / -type f -print0 | xargs -0 du | sort -n

filelight

Posted Feb 25, 2006 2:29 UTC (Sat) by k8to (subscriber, #15413) [Link]

The advantage of filelight is of course that it provides visibility into a significant number of levels of hierarchy simultaneously. You can see which directory is largest, and often what content in that directory is largest. And sometimes even further.

And you can see it all at once in a way that compares the sizes visually instead of numerically. Numeric display is great and all, but it's hard to quickly judge whether these 5 things are really smaller than that one big thing, and so on.

du is a good tool, but filelight gives you much denser and quicker access to some kinds of information.

filelight

Posted Feb 25, 2006 17:49 UTC (Sat) by sbergman27 (guest, #10767) [Link]

Hmmm, when I'm house-cleaning, I just run the above command and go down through the list one by one. I don't really care whether the next item represents the size of a single file or the size of a subtree; It's the next largest object that I can deal with as a unit. I'll eventually get down to those five items in different subtrees that collectively are larger than some items above. But I don't really care about them until I get down to working with objects of that size.

I actually find filelight more difficult to interpret. But, admittedly, I have not used it much.

Unfortunately, while either method is good at freeing disk space, neither helps with 'clutter'. :-(

My sysadmin toolbox (Linux.com)

Posted Feb 25, 2006 19:19 UTC (Sat) by bk (guest, #25617) [Link]

EasyTag is a wonderful program (my one complaint is that the GTK2 version can be a little unstable at times). There are tons of music tag editors around but EasyTag is the only one with the powerful rename/retag abilities. Basically everything that would otherwise require a custom sed pipeline to achieve can be done simply from the GUI interface. Nice.

My sysadmin toolbox (Linux.com)

Posted Feb 27, 2006 16:20 UTC (Mon) by wookey (subscriber, #5501) [Link]

Bloody hell, he's right: why did no-one tell me about htop? It does indeed (even at first glance) fix most of the really tiresome things about top. And I haven't even read the article yet; just the quote has dramatically improved my life :-)

My sysadmin toolbox (Linux.com)

Posted Feb 27, 2006 19:17 UTC (Mon) by sbergman27 (guest, #10767) [Link]

Indeed. I was messing around with htop and hit 's' (like I would in top) to change the delay between screen updates.

It didn't do that.

Instead, it attached to the highlighted process and showed me a realtime strace!

Wonder what other features are lurking in there...

Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds