It is extremely easy for computer scientists (well, and the rest of humanity) to get entrenched in their ways. You’ve learned and taken the time to become a master of a programming language, or tool, and it’s a serious time investment. As such, new tools generally have to be very compelling in order to get someone to switch. For example, I’m a recent svn-to-git convert, and am often met with horrified looks when I suggest others give it a shot. A visiting professor I spoke to yesterday said that it would be years before they stopped using svn.

Recently, I’ve begun using sshfs. It mounts a volume over ssh and appears as any normal folder on your computer. It behaves that way at the command line, or your text editor, or as far as VLC is concerned. For development, I had always maintained a local copy and rsync’d changes to the remote machine I was using. It worked well enough, and was often more convenient than using a tool like Cyberduck.

Aron recommended sshfs, and though it took me a while to try it out, I’m hooked. No more trying to remember if I’ve synchronized my code with the other machine I’m using, only editing and saving. It’s really easy when you have ssh keys set up as well. To mount your home directory on a remote machine:

$> mkdir datastore_mount
$> sshfs datastore: datastore_mount

And now, I’ve got access to remote files on datastore as if they lived in the directory datastore_mount. Unmounting is business as usual:

$> umount datastore_mount

Try it, use it, live it. You won’t regret it.

Tagged with:
 

A professor of mine mentioned that he didn’t use bash but Z shell (zsh). I asked him about his choice and he said that it happened years ago when he asked a system administrator how to accomplish a task in bash and the guy replied that it was really easy in zsh. There have been worse reasons to switch, I suppose.

(Incidentally, the best way I’ve found to improve your command-line-fu is to work near system administrators. They have the most amazing bits of command line ninja magic you’ll ever see.)

I decided to give it a shot this evening and after 30 minutes of use, I’m switching. The features I’ve liked thus far as that when you want to search for a command you recently ran, you don’t need any of the ctrl-r nonsense. One simply begins the command as he remembers it and presses up. Old functionality mapped to the intuitive keystroke. You can scroll through your command history by pressing the up arrow key in bash, but to search, it’s a different story.

The feature that clinched it for me is that it has better autocompletion. If you are not using tabs to autocomplete, you are wasting keystrokes and make typos, but something I find frustrating is that when I want to ssh into some computer with some long and difficult-to-type name, I had to search my history for it. Or, in zsh, you can tab complete the name. It remembers that stuff! Imagine that!

Of course, there’s a very real possibility I’ll switch back if I run into too many gotchas, but this many niceties this soon in make mean think that the good will outweigh the bad.

Tagged with:
 

The best way to learn what command-line tools you should be using is to hang out around system administrators. There are a couple in this office space, and they’re always willing to give advice about which utility you should use instead of another.

I’ve been using scp and rsync since I started using bash, and thought they were the bee’s knees. Of course, they certainly have their purpose, but when it comes to sending files over the tubes quickly, I’ve learned of a better one: nc / netcat.

It goes like this: you’ve got a big file to transfer, and the tubes aren’t really your bottleneck. You might not care about security in this instance, but just want to get it done quickly. You start the netcat daemon on the remote machine, it listens on a port, and then things that get sent to that port are output to a file on that box:

my-remote-machine $> netcat -l -p 1234 > ubuntu.iso

And then on the machine I’m transferring from:

my-local-machine $> netcat #remote-ip 1234 < ubuntu-9.04-desktop-i386.iso

With scp for this same task, I was clocking about 28 MBps, but netcat posted 47 MBps pretty consistently. This is a neat little tool I will be using with some regularity.