Wandering Thoughts archives


A simple way to get a disk space usage summary

In the spirit of my little shell scripts, here's a simple way to get a useful summary of disk space usage on a Unix system:

du | sort -nr | less

(substitute the pager of your choice for less, and use 'du -x' as necessary.)

This is less pretty than the various graphical disk space visualization programs that float around, but I find it gives me pretty much the information I need. It's pretty easy to narrow down what areas of the filesystem, or what specific directories, are using up all of the space.

Applying it to various filesystems on stock machines is often interesting, especially /var; it's often a bit surprising just how much space some packages need. (For instance, a surprisingly large amount of disk space is going to /var/sadm/pkg on my Solaris test machine.)

sysadmin/LittleScriptsIII written at 15:39:23; Add Comment

Fiddling with X selections from shell scripts

I know of three command-line programs that will fiddle with the X selection (and/or the cut buffers) in a way that's useful for shell scripts: xsnarf from Smarasderagd's collection of X things, xcb, and xclip.

I use xsnarf for a variety of reasons, I think partly historical (in that I had it around well before I found the others); I'm jotting down the other two here partly so that I have the information handy the next time someone asks me about this.

You may reasonably ask why this is actually interesting. Here's why:

Shell scripts are the easy way to automate things on Unix. Doing things in X Windows sessions is no exception, but there you need some extra programs as building blocks. One of the important building blocks is some way to fiddle with the X selection (or the cut buffers); having this lets you set things up so that you can do things like select a URL in a terminal window and fire it into a browser.

Yes, yes, some terminal emulators have this specific feature built in now. Some; making a shell script to do this means it works for anything that can make an X selection. Terminals. GNU Emacs. A help browser. Everything.

I would much rather set up a general facility, once, than run around repeatedly adding yet another feature to yet another program, and hoping that I wedged it into all of the ones I care about. It's a lot easier, for a start, and it scales much better.

programming/FiddlingXSelections written at 02:19:51; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.