Command line bookmarks / shortcut script

I grew tired of typing some of the same long commands into my terminal; especially ssh commands to log into a myriad of remote machines. I needed a way to create bookmarks or shortcuts to these long commands that I use on a regular basis. So several month ago I decided solving this problem would be a good opportunity to dabble into some Ruby (which I'd been meaning to do for a long time).

The script is freely available on

I was able to find a ruby command-line template as a starting point (I can't recall where I got the template from). The template handled much of the logic around arguments and help text.

Once the script is installed you can create shortcuts to longer commands. For example, to create shortcut for a long ssh command, you would do the following:

$ go -a devserver
Enter the command to add: ssh -2 nathan.rambeck@some-long-domain-name-or-ip-address
Successfully added the shortcut "devserver" to the command "ssh -2 nathan.rambeck@some-long-domain-name-or-ip-address"

Once your command is saved, you can run your command by just typing "go [shortcut]".

$ go devserver
ssh -2 nathan.rambeck@some-long-domain-name-or-ip-address

I tried to make the script smart so that if you only type in part of the shortcut, it will still figure out what command you want.

$ go dev
ssh -2 nathan.rambeck@some-long-domain-name-or-ip-address

If you type part of a command that is ambigous (ie. some other shortcut contains the same characters), it will prompt you to choose the shortcut you'd like from a numbered list.

$ go server
1.  devserver  ssh -2
2.  testserver  ssh -2
Select #: 1
ssh -2

To install the script on your Mac or Linux machine, you'll need to download the script, copy it to your local share directory then create a symlink to your local bin directory. The commands below should help.

$ cp /usr/local/share/ # copy the script to your local share directory
$ chmod a+x /usr/local/share/ # make the file executable
$ ln -s /usr/local/share/ /usr/local/bin/go # create a symlink in your local bin directory

The shortcuts are stored in your user home directory in a folder called .go using YAML as the storage format.

If you have any questions or problems with the script feel free to drop me a line in the comments.