Computer Science 322 |
We will be using several Unix-based systems within the Computer Science department. Log into and familiarize yourself with your CS Unix account in each of three environments. Later in the semester, I hope to set up a Sparc/Solaris system for our use.
Open a terminal window and execute this command:
uname -a > linux.txt
This will execute the command uname -a, which prints a variety of information about the system you are on, and redirects the output, which would normally be printed in your terminal window, to the file linux.txt.
ssh-keygen -t dsa
You may accept the default file name. You will then be prompted for a "passphrase". You could leave this blank, but I recommend using a fairly long (10 characters or longer) phrase. This will make your key much more secure.
~/.ssh/id_dsa.pub
) to your list of authorized login keys (in
the file ~/.ssh/authorized_keys2
):
touch ~/.ssh/authorized_keys2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys2
If these commands don't make sense yet, they will soon.
In your terminal window that is logged into babyred, execute this command:
uname -a >> linux.txt
This is the same as what you did on your local Linux system, except
that we are using >>
to redirect output. The difference is
that instead of creating a brand new file linux.txt (thereby
overwriting the previous contents of the file), the command will
append the output of uname -a to the end of the file
linux.txt.
uname -a > mac.txt
Once logged in, you should see your same files. On mogul, execute:
uname -a > freebsd.txt
Look at the contents of the files linux.txt, mac.txt and freebsd.txt. Which information is different? Can you guess what some of the information in these files might mean?
Identify the function of and experiment with these Unix Commands:
ls cd cp mv rm mkdir pwd man chmod cat more grep head tail ln find rmdir wc diff tar touch
ls -lad > ls.out
Emacs (emacs from the Unix command line) is a powerful text editor. You will want to become familiar with it if you are not already. Identify the function of and experiment with these Emacs commands:
C-x C-s C-x C-c C-x C-f C-x C-w C-g C-a C-e C-d C-_ C-v M-v C-s C-r M-%
C- before a key means hold down Ctrl and hit that key. M- indicates the "Meta" key, which on most systems is Esc. To issue a Meta command, hit the Esc key, release it, then hit the key for the command you wish to issue. Use the keystrokes rather than the menus. It will save you time in the long run!
Include a brief description of each Emacs keystroke in your file unix.txt.
Learn these commands - you will use them often. Hints can be found in the Unix and Emacs web pages linked from the course website. Ask others in the lab if you're not sure how to do something in the Unix environment. Share your tips and tricks with each other.
Note: when logged into the Clapp 202 Linux systems, Emacs will open in its own window and allow you to use the mouse to move the cursor and to operate the menus. When logging in remotely, you need to forward your X11 display to your screen. To do this from the CS Linux systems, you will need to add the -Y flag to your ssh command.
Verify that you can display an Emacs window from mogul.cs.mtholyoke.edu to one of the Clapp 202 Linux systems. To get your prompt back (by running Emacs - or any command for that matter - in the background), follow your command line with an &. This will allow you to work in Emacs and your terminal window concurrently.
Assuming you have copied the program into a file late.c, you can do this with:
gcc late.c -lm ./a.out > late.txt
To submit this lab, place all of the files that you are to turn in (and nothing else) into a directory, change to that directory, and create a "tar file" to submit.
tar cvf intro.tar *.txt ls.out Makefile
This will create a file intro.tar in your directory. Send this tar file as an attachment to jteresco AT mtholyoke.edu by 2:40 PM, Monday, February 1, 2010.
Please include a meaningful subject line (something like "CS322 Lab 0 Submission") and use the exact filenames specified (for this lab and all semester) to make my job easier when gathering your submissions together for grading. You don't want to annoy your grader with misnamed or missing files just before he grades your assignment. Please do not include any additional files, such as emacs backup files, object files, or executable programs.