The following exercises are designed to give you more practice with the Linux
file system and commands. You can either log into the Linux system
and do them (for practice and to know for sure what they do) or just do
them as a pencil and paper exercise.
When you first log into the Linux system you are in your home
directory. There are three different ways to specify the pathname for your
One is a single symbol. What is that symbol?
One is the full pathname. What is the full pathname without using the
symbol mentioned above?
What is the other notation for your home directory?
If jdoe is a user on the system, what indicates his/her home directory?
Linux has a directory named home. What does it contain and
what is the full pathname of it?
What is the shortest command that takes you to your home directory
no matter where you are in the system?
Suppose you are in your home directory and you execute the following
sequence of shell commands:
cp ~/cs120/labs/lab1/Names.java what
cp ~/cs120/labs/lab1/MyHello.java .
Where are you after you have entered those commands (exactly those, no more)?
How could you find out where you are if you don't know?
Draw a tree showing the structure of your directory after doing the
above commands (assume you have the cs120 and lab directories we have set
up in lab plus things created by the above commands).
As you know, the command to move around the directory structure (to
change directories) is cd. To use the cd command you must also specify
where you want to go (and the "where" must be understandable to the
shell - how you specify it depends on where you are). Suppose you are in
the play directory created above. Where do each of the following commands
take you from play? (Note: some of these commands are errors!)
Suppose you are currently in the labs subdirectory of your cs120
directory and you want to copy UnixQuestions (which is in your lab0
directory) to the directory named "where" created by the sequence of
commands above. Give at least two different ways you can do that.
For each way you give, state where you are after your command or
sequence of commands.