I tripped over an article this week on creating “SSH Bookmarks”, which are basically aliases for hostnames within your
I think this is pretty cool, but I’ve been doing something I think is superior for a while now: Bash aliases for the entire SSH command.
So while the SSH Bookmark idea has us typing the following:
# ssh bookmark
…which is easier than
ssh email@example.com…why not just use a
bash alias and type a single character?
# bash alias
That’s one key (not counting
enter). And if you’re worried about collisions with existing commands, make it two characters…or three, etc.
Even better, if you use SSH keys1 this can drop you right to a prompt without even entering a password on the server side. So yes, SSH bookmarks are pretty cool, but if we’re making the effort to reduce keystrokes, why not utilize what’s available and go all the way? ::
1 If you’re going for the instant shell access, i.e. not having to enter a password on the server side, you need to either have a password on your SSH key or be dropping in as a non-root user. Don’t easy yourself into stupid.
2 The alias within
.aliases looks like so:
alias b="ssh firstname.lastname@example.org"