CS 206 - Introduction to Data Structures

Lab 1

Unix

Friday, Feb 12

Most labs have a 45 minute time limit. It is pretty important that you complete this lab and understand it also. So, for this one take up to 1.5 hours. (This should not take you that long).

Part 1: Access

When it is convenient for you, make sure you can get into Park 230 and Park 231 (you should have keycard access to the rooms). While checking that your keycard works, also try logging in on a machine in the lab using your Unix login. If the machine is booted into windows you will need to restart the machine to get it into Unix.

You probably should not do this during the quarantine period.

Part 1: UNIX

Logging In

You should have received an email from ddiaz@brynmawr.edu with you login information for the CS department Unix system. (If you have not received this email be Feb 10, let me know.)
The Unix operating system consists of three parts: the kernel, the shell and the application programs. The kernel is the heart of the operating system, it allocates processor time and memory, handles file operations and user tasks. The shell acts as an interface between the user and the kernel. The shell is what you are typing to at the prompt after you log in.

Before you can being using Unix, you need to get onto a Unix computer. If you are working with your own machine do the following:

MAC

  1. You are actually already on a Unix computer. Still, get onto a CS department Unix computer.
  2. Open a terminal. (The app is in applications/utils)
  3. Use the ssh command to open a session to a CS machine. The command is ssh YOUR_CS_NAME@powerpuff.cs.brynmawr.edu. You will be asked for your CS department password. Enter it.
  4. That is it. You are now at a UNIX prompt on the CS department machine named powerpuff.

Windows 10 PC

  1. Open a power shell. In the search bar in the lower left type "powershell"
  2. Use the ssh command to open a session to a CS machine. The command is ssh YOUR_CS_NAME@powerpuff.cs.brynmawr.edu. You will be asked for your CS department password. Enter it.
  3. That is it. You are now at a UNIX prompt on the CS department machine named powerpuff.
Note "ssh" is short for "secure shell". What the ssh command done is to set up an encrypted communicatiuon between your computer and a Unix computer. It then starts a shell on the Unix computer for you to interact with via a "command line interface".

Using Unix


Some important UNIX commands: Execute the above unix commands, put answers to the questions to their right
cd What directory are you in? 
What is the contents of this directory?  
cd / What directory are you in? 
What is the contents of this directory?  
cd ~ What directory are you in? 
What is the contents of this directory?  
cd /home/YOU (Replace YOU with your login name) What directory are you in? 
What is the difference between this command and the previous one?  
ls /home/gtowell/Public/206 What did this command do? 
While still logged into Unix, execute the following commands:
  cd
  mkdir cs206
  cd cs206
  mkdir lab1
Leave the CS Unix machine using the command exit You should now be back on your own machine. Within terminal (or powershell) execute the commands you just executed (other than exit). This will have the exact same effect on your own machine (the cd and mkdir commands are the same on Mac and Windows)

Lets finish this lab by copying files between your computer and the CS Unix computer. The command to copy between machines is scp. First, copy a file from CS unix to your machine.

	scp YOUR_CS_LOGIN@powerpuff.cs.brynmawr.edu:/home/gtowell/Public/206/lab01/microtrades.txt localmicro.txt
You will need to enter your password. This command copies a file from my Public directory onto your computer. You will do many such copies this semester. You will learn to love (or hate) ssh and scp.

Edit the file using your favorite text editor (e.g. TextEdit on Mac, Notepad on Windows). The major point here is just to find this file on your machine using a standard GUI tool.

Finally, copy this file back to Unix, but into your directory.

		scp localmicro.txt YOUR_CS_NAME@powerpuff.cs.brynmawr.edu:cs206/lab01/remotemicro.txt
	
You should be able to use a combination of ssh, cd and ls to confirm that the file remotemicro.txt exists in the in the Unix directory structure you created earlier.

Send email to gtowell206@cs.brynmawr.edu with the following:
  1. A completed table for the questions in the UNIX section
The easiest way to do this might be to use your phone and take pictures of the completed table and your screen showing answers. Alternately, if you typed your enswers, just send them. These are just suggestions for how you could turn things in. Feel free to be creative. All I require is legibility.