Espresso: A Concentrated Introduction to Java
Reference: Unix Commands
Summary: In this laboratory, you will explore some of the basic Unix commands.
Contents
Identify a partner for this lab. For today, you and your partner should sit at neighboring computers.
a. Create the directory /home/username/CSC152
b. Determine which files currently exist in that directory.
a. Make a copy of the file
/home/rebelsky/Web/Espresso/Examples/afile
in your CSC152
directory. You will use a form of the cp
command.
b. Verify that that file is now in the directory. You will use a form
of the ls
command.
c. Look at the contents of your copy of that file using the full path name of the file. For example,
less /home/username/CSC152/afile
d. Change your present working directory to CSC152. You will use a form of the cd
command.
e. Verify that you have changed your present working directory.
f. Look at the contents of the file using the relative path name (just afile
). For example,
less afile
a. Attempt to determine what files are in your partner's CSC152 directory. What happens?
b. Attempt to read the afile
file in your partner's CSC152 directory. What happens?
c. Both you and your partner should make afile
readable and make the CSC152 directory executable.
d. Attempt to determine what files are in your partner's CSC152 directory. What happens?
e. Attempt to read the afile
file in your partner's CSC152 directory. What happens?
f. Both you and your partner should make afile
unreadable and make the CSC152 directory readable.
g. Attempt to determine what files are in your partner's CSC152 directory. What happens?
h. Attempt to read the afile
file in your partner's CSC152 directory. What happens?
i. Restore permissions so that your partner can list files and can read afile
.
j. Summarize (for yourself) what this exercise has taught you about permissions.
a. Make a subdirectory of CSC152 called yourusername. For example, a user named smith would create the directory smith
. (The full name of that directory is /home/smith/CSC152/smith
.)
b. Make a copy of your partner's afile
in that directory.
c. Rename your original afile
to bfile
and move it to the new directory.
d. Make that new directory accessible to everyone.
a. Start gedit.
b. Create a file that contains three lines
c. Save that file in your CSC152 directory under your first name. For example, Sam Smith would save it as /home/smith/CSC152/sam
d. Arrange that others in the class can access that file.
e. Obtain as many of your colleagues' info files as you can.
a. Add the following lines to the end of the file /home/username/.bashrc
alias csc152="cd /home/username/CSC152/username" alias home="cd /home/username"
b. Save your modified .bashrc
.
c. Determine what happens if you type cs152
and home
.
(The aliases should not work.)
d. Aliases don't take effect until you open a new terminal window. Open a new terminal window and try typing those commands again. What happens?
If you finish the initial work early, feel free to leave early.
Tuesday, 25 January 2005 [Samuel A. Rebelsky]
Wednesday, 26 January 2005 [Samuel A. Rebelsky]
Tuesday, 30 August 2005 [Samuel A. Rebelsky]
Wednesday, 25 January 2006 [Samuel A. Rebelsky]
This page was generated by
Siteweaver on Thu Mar 30 15:24:43 2006.
The source to the page was last modified on Wed Jan 25 08:31:32 2006.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Espresso/Labs/unix.html
.
You may wish to
validate this page's HTML
;
;
Check with Bobby