Difference between revisions of "Computer lab introduction"

From MolEvol
(SCP is a good alternative to Cyberduck for linux and Mac's)
m (WiFi Login)
Line 25: Line 25:
When you open a new browser window after you've registered, you should see a prompt for name and password.
When you open a new browser window after you've registered, you should see a prompt for name and password.
You username is your initials followed by the 5 digit number on the side of your identification card. Your password is the same.
Your username is your initials followed by the 5 digit number on the side of your identification card. Your password is the same.
E.g. if your name is Jane Bloggs and the your card has the number 12345 on the side then your login details are:
E.g. if your name is Jane Bloggs and your card has the number 12345 on the side then your login details are:
username: jb12345<br>
username: jb12345<br>

Revision as of 08:44, 20 July 2018

"On the other side of the screen, it all looks so easy." (TRON, 1982)


By the end of this introduction, you should be able to:

  • Log in to the class cluster.
  • Navigate and understand the directory structure.
  • Create and edit files and directories on the cluster.
  • Move files to the cluster.

Ask for help if any of these things aren't working by the end!

Slack group

Slack is a messaging/discussion program that allows for large groups to interact as needed.
There is a slack group set up for people to ask questions if needed, and to have discussions.
The slack team is molevol18
If you can't join through the app/website, you can click on this link

WiFi Login

To connect to the cluster you must:

1. be logged on to the MBL-REGISTER wifi network.

2. have any virtual private network (VPN) turned off.

Full instructions can be found here

When you open a new browser window after you've registered, you should see a prompt for name and password. Your username is your initials followed by the 5 digit number on the side of your identification card. Your password is the same. E.g. if your name is Jane Bloggs and your card has the number 12345 on the side then your login details are:

username: jb12345
password: jb12345

Some people have been having trouble, if it isn't working find or email Rachel (williams.rachelc@gmail.com) or any TA, or ask on the Slack group.


Please download and install the following programs:

After you have installed Notepad++, open it. Go to Settings, Preferences, New Document, and set the line endings to Unix.

If you have time at the end of this lab, please use it to download the software listed here: Divergence time software

Remote computer access software

We will use Secure Shell (SSH) and sFTP to connect to the servers. The servers are powerful computers where we can run the programs much faster than would be possible on your laptop. In order to access these you need to log in to your assigned server


SSH stands for "Secure Shell." These are programs that provide a Unix shell so that one can enter commands and log onto other computers (i.e., those on the server where we will be doing our analyses).

You must be on the MBL register internet or this will not work

SSH on Linux and Mac Os X

First, open a terminal window:

  • Linux: Konsole (KDE), gnome-terminal (GNOME)
  • Mac: Terminal (in /Applications/Utilities)

First we want to log on to the class servers.
In the following command replace username and server name with the user and server name on your piece of paper:

ssh username@servername

For example if my username is jbloggs and my server name is class-04 I type:

   ssh jbloggs@class-04.jbpc-np.mbl.edu

It will then ask for your password which is on the back of your card under your username

SSH on Windows

On windows you can use git for windows or PuTTY for accessing the class servers.
If using git for windows, follow the Linux/Mac approach above.
To set up SSH on PuTTY Enter your username and servername in the "Host Name or IP Address" field You can find your username and servername on the piece of paper:


For example if my username is jbloggs and my server name is class-02 I type:


Enter a name for this configuration (e.g. MolEvol) where it says "Saved Sessions" and click Save Now you can access the cluster by clicking on that saved session.

PuTTy copy paste tip: PuTTy FAQ

Copy and paste works similarly to the X Window System. You use the left mouse button to select text in the PuTTY window. The act of selection automatically copies the text to the clipboard: there is no need to press Ctrl-Ins or Ctrl-C or anything else. In fact, pressing Ctrl-C will send a Ctrl-C character to the other end of your connection (just like it does the rest of the time), which may have unpleasant effects. The only thing you need to do, to copy text to the clipboard, is to select it.

To paste the clipboard contents into a PuTTY window, by default you click the right mouse button. If you have a three-button mouse and are used to X applications, you can configure pasting to be done by the middle button instead, but this is not the default because most Windows users don't have a middle button at all.

You can also paste by pressing Shift-Ins.


You should have a black screen asking for your password, which is on the piece of paper. Type it in. You will not see the letters you are typing.

Changing your password

The first thing to do once you have successfully logged on to a server is to change your password. This is done by typing:


This will prompt you to enter a new password so do so and press the enter key. Next you re-enter the new password and again press enter. It may then ask you for your LDAP password and you should type in your original password given on the back of your card.
Once you have done this every time you ssh in to the server you will use the new password created.

Basic Syntax

Unix commands follow the general format of:

command -options target

Not all commands need options (sometimes called flags, and generally preceded by a single or double hyphen ("-" or "--")) or targets, but others require them.

  • For example:
    • cd homedirectory uses the command "cd" (change directory) and the target "homedirectory" to move from the current directory into the subdirectory called "homedirectory"
    • ls -l homedirectory uses the command "ls" (list), the option "-l" for long-list, and the target "homedirectory" to list the contents of homedirectory in the "long list" format, which provides more thorough descriptions than does the regular "ls".

Notes on syntax for directory structure

  • Two dots (..) indicates the parent directory of the present working directory. So, for example, "cd .. will move you back one directory.
  • One dot (.) indicates the present working directory. So, for example, "cd ." will keep you where you are. There are times where the single dot can be more useful than this...
  • The tilde (~) refers to your home directory. On the class machines your home directory is /class/yourusername. You'll also have a unique home directory on your laptop, etc. The tilde is very helpful if you get lost while using the terminal -- just type "cd ~" and you'll be back in your homedirectory.
  • A forward slash (/) by itself or at the start of a path refers to the root of the filing system -- the folder that contains all other folders.
  • NOTE: do not make changes on the class server in the root folder or any shared folders. All your work is to be done in your home directory or a subdirectory.

Intro-to-Unix tutorial

Please go to the UNIX tutorial and go through the step by step guide there.

Downloading files

In order to get a file from an online source you can use wget. Type:

wget <URL>

Where the url is the website address of the file you wish to download. For example

wget https://raw.githubusercontent.com/gtiley/misc/master/mbl2018.txt

Will download the file molevol2016.txt to the directory you are in. Note: If you are on OSX and trying to do this locally to your machine, this won't work. Curl is an alternative for doing this. See if you can figure out using google how curl works. Wget will still work on the class servers, regardless of your operating system.

Copy this file to a file named <yourname.txt> (remember! No spaces!)

Edit the statement in the file using nano, to a fact about yourself.

Copy it to the /class/molevol-shared/facts directory.

Ask a person next to you their name, and find and read their fact!

Setting up Cyberduck

Creating a bookmark

When you open Cyberduck a screen should appear that has some default connections bookmarked such as Google Docs and Amazon.
Click the '+' button at the BOTTOM LEFT to create a new bookmark (NOT the one with the globe at the top). Here we will put the details of our cluster login and save it so that each time we open Cyberduck we don't have to re-enter the details. Click the dropdown menu that says FTP (file Transfer Protocol) and select SFTP.
Create a nickname for this bookmark. For example mine is called 'MBL cluster'.
In 'server' write the class number of the server you were given. For example, I am rwilliams@class-04 so I put class-04 in here.
In the username box place the username you were given. This is likely your first initial and your last name. For example mine is rwilliams.
Once all these details are entered close that screen. (e.g. on a mac click the red circle or on windows click the X).
A new bookmark should have appeared named whatever you set as the nickname. Double click on this.
Cyberduck should ask you for the password. Type in the password you changed it to earlier. There should be a button asking for you to 'add to your keychain' or something similar. Make sure this box is ticked. Once done, click to connect.
This may connect you directly to the cluster. If not double click on the bookmark again.
You now should see your home directory on the cluster. You should see the file "yourname.txt" that we created earlier.

Navigating the cluster on Cyberduck and transferring files

Navigating through the class cluster in cyberduck is easy.
Double click on a folder to open that folder.
Above the window that lists files there should be your path. For example when I login my path shows '/classfs/rwilliams'. This tells me where I am on the cluster right now. If you click this dropdown menu you can see each folder you are in. For example when I click on the dropdown I have a line that says /classfs/rwilliams, one that says /class and one that just says /. Clicking on any of these will allow you to navigate to that folder. If you get lost in folders you can click this dropdown and select /class/username (where username is your own username) and this will bring you to your home directory.
An alternative way to go to a specific folder is click the 'Go' menu at the top of Cyberduck and click 'Go to folder'. Here you can write the full path and go to a specific folder. For example, if you are logged in to the cluster through a terminal/putty you can type 'pwd' and then copy that path into the 'go to folder' box and now Cyberduck will be in the same folder as your terminal window.

There are two ways to download files from the class cluster to your computer.
1.If you double click on a file name, this file will be automatically downloaded to your default download folder. A transfer window should open up when you double click on a file. At the bottom there will be a line that starts 'local file'. This is the location of that downloaded file on your own computer
2. An easier way to get files both to and from the class cluster through Cyberduck is through drag and drop. If you have an open finder window (mac) or explorer window (windows) you can click and drag a file from the Cyberduck window to the finder/explorer window directly. You also can do this in the reverse (drag a file from finder/explorer to Cyberduck) to place a file on the cluster in that folder.

Using Cyberduck for remote editing

Instead of using nano or similar to edit files on the class cluster you can use a GUI text editor like TextWrangler through Cyberduck.
In cyberduck click 'Cyberduck'->'Preferences' on a Mac or 'Edit'->'Preferences' on Windows.
Click the 'Editor' button.
There should be a dropdown menu where you can select a text editor. Select TextWrangler on a Mac, Notepad++ on Windows.
Close this window.
Now when you single click on a file in Cyberduck, a 'Edit' button with the icon for the editor you selected should appear in the top right corner. Click this button to open that file in the editor. Now you can edit the file on the cluster without downloading to your local computer. When you save this file it will be automatically updated on the class cluster.

Short Cyber Duck Exercise

The easiest way to transfer files using CyberDuck is with drag-and-drop. Try to drag a file from your desktop (or another folder of your choosing) from the CyberDuck window. This method allows you to choose unique destinations for each file you transfer.

In CyberDuck, double click example.txt your 'myfolder' on the cluster. To where does this file download? CyberDuck also allows for more permanent modification to how files are downloaded, you can set automatic download locations. If you want to change this, under Edit -> Preferences -> Transfers, you can edit this.

Lastly: Right clicking (Ctrl click on a Mac) will allow you to select Download to or Download As. This will allow you to choose a location, and if you choose, a new file name for the file.

These methods will all work to get files from the cluster to your computer, and each have their own benefits. Generally, you will be fine using any of them throughout the course.

Make a folder on your computer to hold all of your lab materials from this course!

SCP is a good alternative to Cyberduck for linux and Mac's

There are two places you may need to get files on to the class server from: your own computer or an online source
In order to get files from your computer to the server open a terminal window and navigate to the folder on your computer using the commands like cd. Once in the folder containing the file you want to upload you type

scp filename username@classServername.jbpc-np.mbl.edu:~

e.g. just like cp, the format is scp <from> <to>

To get files from your computer to the cluster:

   scp text.txt rwilliams@class04.jbpc-np.mbl.edu:/class/rwilliams

To get files from the cluster to your computer:

   scp rwilliams@class04.jbpc-np.mbl.edu:/class/rwilliams/testfile.txt .

Useful links

The following table contains a list of commands that will allow us to navigate through the directory structure. The entries are linked to their Wikipedia pages, which contain very useful examples.

Some basic commands
Linux/Mac Description Syntax (Linux/Mac)
pwd print working directory pwd
ls list directory contents ls
history display command history history
cd change directory cd directory_name
mkdir make directory mkdir directory_name
cp copy files cp original_filename copied_filename
mv move files (the same as rename files) mv original_filename moved_filename
clear clear the screen clear
exit quit command line exit
' ' Ctrl-E Go to the end of line
' ' Ctrl-A Go to the beginning of line