Pitt | Swanson Engineering
Mac Unix

Unix Tips for Mac

SSH

To SSH to the unix machine, open Terminal and type

ssh abc123@unix.cis.pitt.edu

where abc123 is your username.
Remember to use nano instead of pico for editing purposes.

Having to type that long line to ssh to the Unix machine can get tiring.
There is a way to create an SSH alias.

First, type

nano ~/.ssh/config

If the file is empty, type these lines.
(If it is not, append these lines to the end of the file).

Host pittHostName unix.cis.pitt.eduUser abc123

Now, typing the SSH command is a breeze.
And it will still properly ask for your university password.

ssh pitt

Editing Unix Files

To ensure files are viewable and editable by nano in Unix, they must be plain-text.

All files created on Textwrangler are plain-text.

Textedit can create plain-text files, but you must ensure it is in plain-text mode.
If it is in rich-text mode, at the top of Textedit windows, there will be a ruler and tools to change font types.
To change it into plain-text mode, select "Format" > "Make Plain Text", or hit "Shift-Command-T".

Cyberduck

Cyberduck is an SFTP program (like WinSCP) that works on both Windows and Mac OS X.
It is free and can be downloaded from the Cyberduck website .
The download link is on the right.
Once downloaded, move it to the "Applications" folder and open it.

You can start a file transfer session by clicking "Open Connection".
After that, select SFTP as the protocol and type in your information.


  cyberduck_login  

The window supports drag-and-drop interaction and in some ways works as a Finder window.
Simply disconnect from a session by clicking the "Disconnect" eject icon in the upper right.

You can delete all of the default bookmarks (though I find the Google Docs bookmark handy).
You can add the Unix machine to the bookmarks by clicking the "+" sign in the lower left corner of the window.

SCP/SFTP

The scp and sftp Unix terminal tools are provided standard with Mac computers.

To use scp , consider the syntax,

scp [-r] [user@source_host:]source_file [user@destination_host:]destination_file

Brackets denote optional arguments.
The source and destination file paths are relative to the user's current and home directories, respectively, unless provided absolutely. So, some examples, to copy a file in the current directory to the home directory of the Unix machine.

scp some_file abc123@unix.cis.pitt.edu:.

Similarly, one can copy a folder in the public folder on the Unix machine to the current working directory.
To copy folders, one must provide the -r to tell scp to copy recursively.

scp -r abc123@unix.cis.pitt.edu:public/some_folder .

Also, if you created an SSH alias, it can make commands shorter

scp some_file pitt:.scp -r pitt:public/some_folder .

sftp is another command that can be used for file transfer.
Start a session by

sftp abc123@unix.cis.pitt.edu

Or if you created an SSH alias

sftp pitt

Then get or put files.

Additional information about scp and sftp can be found in the Unix section of your textbook.