SSH Shortcut for Purdue Servers

Tired of typing data.cs.purdue.edu?

Authored by
May 10, 2020

It can be tedious to type ssh <username>@<machine>.cs.purdue.edu 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.

Installation

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

<username> () {
    ssh <username>@${1:-<default_machine>}.cs.purdue.edu
}

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

hankinsj () {
    ssh hankinsj@${1:-data}.cs.purdue.edu
}

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

Usage

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

Example

$ hankinsj mc04 This will connect me automatically to mc04.cs.purdue.edu.

Category: technical

Was this page helpful?

Thank you for your feedback!:tada: