Almost all of zsh-dwim’s transformations up to this point have been about laziness. If you untar something, zsh-dwim will let you
cd right into the directory it was extracted to without having to guess at the directory name. If you fail to
ssh into a host, it will construct the command to remove that host from your
known_hosts file for you.
These new transformations aren’t just about laziness. They are also about memory. They’re helping me spend less time referring to
man pages and more time running commands.
The new, simple
rsync quite a bit. Most of the time I only care about moving some data around and I don’t care one bit about permissions, hard links, or crossing file system boundaries. Once every few months, though, I do care about these things, and when I do, they are VERY important.
I always know off the top of my head to run
rsync -a for “archive,” but when you’re trying to effectively clone a drive, this isn’t really enough. You might very well need to copy ACLS and extended attributes. You will almost certainly want to handle sparse files correctly.
I don’t know about you, but on the rare occasions when I need these options, I end up checking and rechecking the
man page to make sure I didn’t miss anything. Having the whole set of options (
-aHAXS in my case) pop up at the press of a button is handy. It’ll be even handier in a few months when I forget all this and need to do it again.
The new, simple
I started using
dstat some-time last year instead of
vmstat. It has much nicer, colorized output and it can monitor quite a bit more things than
vmstat. In fact, I have
vmstat aliased to
dstat -cpgdms -D total).
The two things I tend to want to monitor with
dstat are the usual
vmstat numbers and disk I/O. I would often build up a
dstat command to monitor a specific block device, but lately I have found that
dstat -f is all I really need, so at this point zsh-dwim toggles between
Why not just use aliases?
I had already given this a lot of though, even before reading comments about using aliases instead of zsh-dwim on Reddit. Aliases are wonderful and I use them all the time. I have two problems with them, though.
First of all, I have to remember that I have the alias that I need. For commands that I use daily or weekly this should be pretty easy. I don’t make “perfect” clones with
rsync often enough to remember that I have an alias for that.
The other problem with aliases, and this is my biggest concern lately, is that they hide the command that you’re actually running. Most of the time, this opacity is welcomed. I really don’t care that when I run
vmstat it is actually running a more complex
dstat command, but I most definitely want to see which switches are being passed to
rsync. It makes it easier to modify them or add more switches.
Future plans for zsh-dwim
I’m keeping my eye open for more commands that I tend to run in series so that I can turn them into transformations. I’m running pretty low on ideas, though. I’ve optimized my own workflow pretty nicely already. I’m more a sysadmin type, though. I’d really be interested in hearing from some programmer types. There have to be some
git-related workflow ideas that I could add to zsh-dwim, but I’m just too light of a
git user to know what they are.