Wednesday, July 3, 2013

dud - or another bash alias post

I figured since I haven't posted in about 12 years I'd quickly post a few bash aliases I'm tending to use very often

DUD!

alias dud="du -h -d 1"


Now this one depends on your operating system of choice. On Mac OSX that is the correct command.

This gives you the disk usage of whatever directory you pass it (ex. pass it '.' for current) and it will also recurse into each directory it finds. But only once. I aliased a 1 in there instead of leaving it open because I tend to only care about the immediate directories underneath. You can change that of course. It also gives the file contents in the current directory (identified again by '.'). It will also default to the current directory if you don't supply one but I tend to forget that.

Some other operating systems and/or versions of du may require you to spell out that option like this:

alias dud="du -h --max-depth=1"

That one will always tend to work in my experience while the latter may not in some cases.

Very handy. Play with it for a while. There may be other small changes depending on the environment. For example on my linux VM it ends with a grand total.

dud is a funny name too


Decompression Commands


alias xx="7z x"
alias xl="7z l"


No, those aren't the sizes of my clothes (Comfortable and tight?)! This uses the 7z decompression application to either list (xl) or decompress/eXtract(xx) an archive file. You could substitute another application with its particular options but 7z works on almost everything. Zip, rar, 7z (dur), tar, gzip, etc


Ok this is over because I need to go back to work. Hope that helps someone who googled a very specific combination of words! SEAL ATTACK TIRE FONTAINE BUBBLE!