Вы находитесь на странице: 1из 3

CS171Z – Refresher on Linux skills

The primary goal of this tutorial is to get you comfortable using the Linux operating system and a
command line environment from a terminal. Successful completion of the labs and homeworks
depends on you mastering this new environment.

Preparation:
• Read the following material:
◦ Webpage explaining several Unix/Linux commands
◦ The first two mini-lectures from Part 2 from the supplemental course notes (“Using and
interacting with a computer in general” and “Using and interacting with a Unix computer in
the Math/CS Lab”)

Four Exercises:
1. Necessary skills.
Make sure you can launch the following applications. Follow the following menu sequences.
a) Web browser (Firefox or Chrome)
Applications → Internet → Firefox (or Chrome)
b) Terminal
Applications → System Tools → Terminal
c) File browser
Places → Home Folder
d) Text editor (Gedit)
Applications → Accessories → gedit

If you are still confused, you can read this material at your convenience: Interacting with a
computer (in general) -- this webpage will explain the following topics:
• logging in to the system
• starting a terminal
• issuing commands in a terminal
• files and directory hierarchy

2. Changing your shell. (This step may be done for you as of Fall 2013)
a) Login to ENID at https://enid.emory.edu/idm/user/login.jsp
b) Select the option for “Change Unix/Linux shell.
c) Change from “ksh” to “bash”.
d) Save your changes
e) Logout of ENID
f) This change will take effect the next time you log-in to the Math/CS computers. (You can
logout/login now if you want it to take effect immediately). It enables a more user-friendly
command line interface for you.

3. Command line practice


Open a terminal window and enter the following commands. After each command, the red text
specifies things to look for or notice. Observing these things will help you cement your
understanding of the directory hierarchy and command line environment.

pwd print working (current) directory. Notice the output: /home/yourid


ls list contents of directory. Notice the output
ls -l list, long format. Notice the output and how it differs from the
previous command
ls / list the root directory. Notice the output.

cd cs255 change into your cs255 directory (make cs255 the current directory)
ls directory should be empty....
pwd Notice the output: /home/yourid/cs170

mkdir hw2 create a subdirectory for this assignment


ls you should now see the lab1 subdirectory

cd hw2 move into the hw2 subdirectory


pwd Note the directory hierarchy
ls Should be empty

touch myfile this command creates an empty data file named myfile
ls Can you see the file name?

cd Can you guess the current directory after this command executes?
pwd Check your guess. Did you guess correctly ?

cd /home/cs255000/share Note: You should replace the 'xxx' with your section
number
ls
touch myfile This should fail for students. You will not have the proper
permissions to write to this directory.
ls /home /home contents depend on machine but you should see a lot of
directories

cd without anything else, this returns you to your home directory

4. Homework
Your home directory should have a cs255 directory already created for you. If it does not, send
email to Prof. Summet immediately so we can get this straightened out.

In general, assignments will begin by asking you to do some basic file setup. You should begin
by create a subdirectory for the assignment:
mkdir assignment-name (example: mkdir hw4)

and moving into that directory (make it the current directory):


cd assignment-name (example: cd hw4)

Next you will need to copy some files, usually from the class share directory:
cp source-path destination path
(example: cp ~cs255000/share/hw4/hw4.s .)
This would copy the hw4.s file from the cs255 account in the share/hw4
folder to the current directory (which should be the hw4 directory if
you're following these commands in sequence)

You can then fire up gedit and work on the file provided:
gedit hw4.s &
(the ampersand launches the program in the background so you can still
use the terminal window.)

Once you have finished the HW, you will be asked to submit it using a class specific program.
The command will be given on the homework. You need to run that command from the
subdirectory where the file(s) you wish to turnin are located. When you submit, you should see
some text containing the line:
+++ALLOWED
(assuming you are submitting within the allowable time-frame of the assignment.)

Tips and Tricks:

Nifty shortcut: On Linux systems, there is a cut and paste shortcut. Highlight the text you want to copy
with the left mouse button. Click in your email window. Click the MIDDLE mouse button (might be a
scroll wheel). Your text is pasted into the window!

The lab staff in the MSC library are very good with Linux. If you're having trouble with the command
line or navigating, ask them to help you diagnose the problem.

If you wish to work remotely, you must still access the Math/CS computers which have the necessary
software installed. You can setup your computer/laptop to display the programs even though they are
running on the Math/CS computers. See this tutorial for information:
http://www.mathcs.emory.edu/~cheung/Courses/RemoteAccess/index.html

Вам также может понравиться