It can be tedious to type ssh <username>@<machine> over and over again whenever you need to login to a CS machine.

Here’s a little shell function which shortens this command to just with an optional argument of the machine you wish to connect to.


Copy and paste the following code into your shell rc file. This may be ~/.bashrc or ~/.zshrc.

<username> () {
    ssh <username>@${1:-<default_machine>}

Make sure to replace any information in between the < and > symbols. For example, my function looks like this:

hankinsj () {
    ssh [email protected]${1:-data}

My username is hankinsj and my default machine is data in this example.


$ <username> You can include an optional argument which specifies the machine to connect to. Otherwise, it will connect to your chosen default machine.


$ hankinsj mc04 This will connect me automatically to