CMSC 121, Section 0101, Fall 2004
NEW! Assignment 4 has been posted. It is due Friday, 9/24/2004, before 2:00pm.
Assignment 3 has been posted. Scroll down to the bottom of this page to find the third assignment, which is due Tuesday night, 9/21/2004.
Here are
notes from the class on Monday, September 13th, 2004. That day, we
covered many UNIX commands, shell basics, the tcsh shell, and a few
environment variables. This is great review for your test, as
roughly half the questions on the test will be based in some way on this
material.
The test will be given during class on Friday,
September 24, 2004. It counts as 50% of your grade. Remember,
this course is graded pass/fail, and a 60% is passing. Each
assignment is worth 10%. The test will be closed-book and
closed-computer.
Lecture notes for the course can be found at Dan Hood's CMSC
121 Homepage.
Click here for a list of basic UNIX commands.
Click here for more UNIX commands.
Socrates Man Page Viewer.
Pine reference
Email your assignments to me as attachments.
bill@coral-lab.org is my email address. You must use some plain-text
format for assignment submissions, so if you prepare a document on a
Windows machine, use notepad instead of Word.
Assignment 1: Due Tuesday, 9/14/2004, before 11:59pm.
1. Name two UNIX machines to which your GL account grants remote access.
2. Say you are working on a UNIX machine. Name your home directory. Give the full path, beginning with /afs/.
3. What UNIX command can you use to check how much of the allocated disk space on your GL account you are using?
4. If you are over your GL account's disk space limit, can you continue to receive mail at your umbc.edu email address?
5. How might you recover a lost file that you saved to your account three days ago?
6. Why does UMBC's OIT office prohibit telnet connections to UMBC servers?
7. Describe in your own words the following two parts of a UNIX system: the kernel and the UNIX shell.
8. In order to run graphical applications on a UNIX server from a remote machine and be able to see the graphics, what must be installed on the remote machine?
9. A UNIX system's Graphical User Interface (GUI) is just another application that runs on top of the kernel. Many UNIX systems can be installed without the GUI. Is this the case with Windows XP?
10. Using the Gnome desktop manager, how do you lock your screen? Why would you want to lock your screen? How do you log out?
Assignment 2: Due Friday, 9/17/2004, before 11:59pm. (changed)
This assignment is taken from Daniel Hood's CMSC 121 web page. Notice that I
have not asked you to submit the assignment using the submit command.
Rather, I would like you to email me the file hw2.txt, which will be a log of
all the commands you issued for this assignment along with their output. The
steps below will explain how to make the file hw2.txt. This assignment is
very important and will count as two assignments, that is, 20% of your grade.
If you have any questions, please email me before the due date, and I will
provide help ASAP. One final note: if you want to name the directory used in
this assignment cmsc121 instead of cmsc291u, you can. But I don't care, so
it's up to you.
In order for the whole assignment to be logged to a file, you will need
to sit down and complete the whole thing from beginning to end
without logging out. If you make mistakes or typos as you go, do not
worry about it. Fix and re-issue the command.
I strongly recommend that you figure out what command and what arguments
you are going to be typing for each step before you actually issue the command.
This way you can test out the command before you actually sit down and log the entire assignment.
- Connect via SSH to linux.gl.umbc.edu. You will be doing this assignment
via a SSH connection to one of the Linux servers. You may use the SSH
client of your choice.
- Make sure that you are in you home directory. You should know how to
do this. There are several ways of accomplishing this, take a look
at the notes if you need to find out.
- First type script at the command prompt.
This will allow for the entire interaction that you have with the
UNIX environment to be logged to a file called "typescript".
You should see the message "Script started, file is typescript".
- Verify that you are in your home directory. Meaning issue the command
that prints out the current working directory.
- Make a directory called "courses". If for whatever reason this
directory already exists (you already created it as part of organizing
your account) then simply skip this step.
- Change the current working directory to this newly created directory called
"courses".
- Again issue the command to verify that the current working directory is
now in this "courses" directory.
- From within this directory make 2 different directories called
"cmsc291u" and "temp".
- Now do a normal listing of this directory. You should note the 2 new
directories now show up in this listing.
- Now let's create an empty file called "file0".
- Now do a long directory listing.
- Copy "file0" into the directory "cmsc291u"
- Let's copy some more files. This time we will get them out of my public directory.
Copy the "file1" from /afs/umbc.edu/users/d/h/dhood2/pub/cmsc291u/hw2/ into the
directory called "cmsc291u"
- Now copy all 3 of these files out of my public directory. Copy "file1",
"file2" and "file3" all into the directory called "temp".
- Now do a directory listing of each of the 2 directories "cmsc291u" and "temp"
- Move "file0" (the one that is in this current directory) into the "temp" directory.
- Copy "file3" (which is in the "temp" directory) into the "cmsc291u" directory
- Change directories into the "temp" directory
.
- Show the contents of both of "file2" and "file3" using the command of your choice.
- There is 1 slight difference between these 2 files. Use the UNIX command that will show the differences between
these 2 files to show us what it is.
- Change the directories to the parent of the current directory. You can do this using one of the special arguments
that I showed you for the change directory command or you can type in the full absolute pathname.
So once this command is done you should be in the "courses" directory.
- Now let's issue the command to remove a directory. Let's try to remove the this "temp". Issue the
command to remove a directory and note what happens. We get yelled at because the directory is not empty.
- So let's fix this. Remove all files that are in the "temp" using the commands of your choice. If you changed
directories to accomplish this, return back to the "courses" directory.
- Now you should be able to remove the "temp" directory. Try again to issue the command
that will remove this directory. Sine the directory is empty it should work.
- Go ahead and do a directory listing to verify that the directory has been removed.
- Now change directories into the remaining "cmsc291u" directory.
- There should be 3 files in this directory. Verify that by doing a directory listing.
- Let's see how large each of these files are. Do a long directory listing.
- The numbers that are given as the file size are in bytes. We talked about a flag that will allow us to
print this out in a more human readable format. Issue the directory listing command again, thus time using the human readable
and longoptions.
Note that filesize are now given in Kilobytes where applicable. Had we had files that were several Megabytes
in size we would see the size being reported in with an M for Megabytes.
- Go ahead and issue the command to print out the file called "file1". Note: You will not
be charged for this printout. OIT now has the printer system setup so that your job does not actually
print until you go in and ask a person at the counter for it. At which point the job is sent from a
waiting queue off to the printer.
- Now that we know the sizes of these files let's get some other statistics on them. Issuse the command to get the
total number of words, characters and bytes for the file called "file3". You should see that the total number of
bytes matches what the long directory listing showed.
- Now using a wildcard, issue a command that will get the total number of words, characters and bytes for all files
in this directory. Notice now that this command has also returned us grand totals for all of the files combined.
- Let's go ahead and remove all 3 of the files that are
in this current working directory (which is "cmsc291u").
- This directory should now be empty. Verify that using by listing the contents of the directory.
- Change directories back to your home directory. You could do this using the ..characters, but instead
show me another way to change back to your home directory. Do not use an absolute path either
(/afs/umbc.edu/users/u/s/username/home/). Part of the goal of this course is to get you to work more efficiently. There are
many shortcuts to achieve the same effect.
- Issue the directory listing command in such a way that you see some of the hidden files and directories that
exist in your home directory.
- Now issue the command that will print out the current date and time
- Issue the command that will print a list out of all the users that are logged onto the computer that you are.
- Almost finished, type exit at the command prompt.
This will close the session that logged all of your activity to a file.
You should see something like "Script done, file is typescript".
- Now that all of the assignment has been logged to the file called
"typescript", I want you to make sure that it logged
everything correctly. Use one of the commands that we discussed to
see the contents of the file.
Note that when you
delete characters on the command line, for example, odd characters are added
to the typescript file. That's perfectly fine and normal, and don't worry
about it.
- The log file is currently named "typescript". Change its name to hw2.txt and email hw2.txt to me as an attachment.
Assignment 3: Due Tuesday, 9/21/2004, before 11:59pm.
Email your answers to me as an attachment in plain-text format. Please let it be clear that I am not asking you to run these commands and log them using the script command. I merely want you to tell me what command you would use to perform each of the actions listed below.
Note that you can test out your commands on the
command line before committing to them as answers here. For each
problem, give a one-line answer. That is, if
your solution requires multiple commands, separate them by semicolons.
You might find the following to resources useful: Dan
Hood's lecture notes and my notes from our
classes on the command line.
- Open a file named foo in emacs, but set it to run in the background.
- Repeat the 6th command in your tcsh shell's history.
- List all locations in your PATH variable where the more command may be found.
- Display the instance of the emacs command that is executed when you type in the emacs command.
- Find instances of the string "abcdefg" in the file ./foobar along with the line numbers at which these instances occur. Also, ignore case, meaning that your command should find instances of "ABcdeFg" as well as "abcdefg".
- Find the location of the file foo within the directory tree rooted at the current directory.
- Issue the who command and save the output to the file foo.
- Issue the who command and append the output to the current contents of the file foo.
- Use the output of the who command as input to the wc command to see how many users are logged on to the host machine on which you are working. Use the flag with the wc command that only displays the number of lines.
- Terminate the process with process ID 24601.
- Issue the command that would allow you to determine the process ID of an emacs job you have running in the background.
- Issue the command that makes the changes to your .cshrc file take effect.
- Change shells to the bash shell.
- Change shells to the tcsh shell.
- Display the value of your PATH environment variable.
- Create an alias such that whenever you use the mv command, you will be prompted before overwriting an existing file.
- Create an alias such that you can type quota to check on your account quota without having to use the -v option.
- Repeat the most recently issued command. (This command is 2 characters long).
- List all of the environment variables currently maintained by your shell.
- Display your username.