CS 151 - Introduction to Data Structures

Lab 2

Unix

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/151 What did this command do?  
cat /home/gtowell/Public/151/L02/HW.java
cat /home/gtowell/Public/151/L02/HW.class
What did the second command do? Is the file HW.class readable? One sentence: explain.  
A good understanding of these few UNIX commands is about all you need to this course. (Many Unix users know little more than these.)

Lets finish this lab by copying files between your computer and the CS Unix computer. The command to copy between machines is scp. "scp" is "secure copy"; it basically extends the cp command so it can be used between machines.

First make a directory on your machine for this lab. The directory should be within the cs151 directory. (use cd and mkdir as needed).

Next, move into the diretcory you just made

Copy a file from Linux to your local directory. (Note that if you are doing this all from within linux you can use cp rather than scp (ask me))

	scp YOUR_CS_LOGIN@goldengate.cs.brynmawr.edu:/home/gtowell/Public/151/L02/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 or you can use VSC). 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@goldengate.cs.brynmawr.edu:cs151/lab02/remotemicro.txt
	
You should be able to use a combination of ssh, cd ls, and cat to confirm that the file remotemicro.txt exists in the in the Unix directory structure you created earlier.

Send email to gtowell151@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 answers, just send them. These are just suggestions for how you could turn things in. Feel free to be creative. All I require is legibility.