To get to our first destination, type cd /
. The
directory /
is the “root” directory; it is an absolute
path. If you think of the directory structure as an upside-down
(Australian) tree (root at top), the directory /
is at the
top. Type pwd
and see where you are. Type ls
;
you should see that the directory home
listed with several
other directories. On a Mac, this directory is /Users
. Here
is what the directory structure looks like on a PC running Red Hat
Fedora Core 9. Yours may have a slightly different appearance.
unix> cd / unix> ls bin etc lib mnt root srv usr boot home lib64 opt run sys var cdrom initrd.img lost+found proc sbin tmp vmlinuz.old dev initrd.img.old media root selinux vmlinuz unix>
Now type if we type cd home
then ls
, you
will see one or more directories. On the machine being used here, you
would see
unix> cd home unix> ls guest lost+found morrison
This machine has two users, morrison
and
guest
. Since it is a personal computer, it does not have
many users. You may be working on a server in which there could be
dozens, or even hundreds of other users who are organized into various
directories.
Here is an example from a fairly busy server.
unix> cd /home unix> ls 2016 2018 2020 gotwals menchini rash 2017 2019 cs keethan.kleiner morrison rex.jeffries unix>
The directories with the years are directories full of user’s home directories. We will list one here. It has quite a few users in it.
unix> ls 2019 allen19m hablutzel19k laney19m mullane19n wang19e bounds19a hirsch19m lheem19h ou19j wolff19o carter19d hou19b lin19b overpeck19c yang19j cini19a houston19b liu19c perrin19p zhuang19a eun19e houston19p manocha19a sakarvadia19m gupta19a knapp19t mitchell19m villalpando-hernandez19j unix>
Try typing cd ..
; the special symbol ..
represents the directory above your cwd
. Now you can climb
up and down the directory structure! The ..
symbol works
like the up-arrow in a file chooser dialog box in Mac or Windoze. You
saw this when you did the last group of exercises.
Practice this; go back to your home directory. Make a new directory
called mudpies
. Put some files in it. Make new directories
in mudpies
, got down inside these and make more directories
and files. Practice using cd
to navigate the tree you
create. When you are done, get rid of the whole mess; remember you have
to go to the bottom, empty out the files using rm
and then
use rmdir
to get rid of the empty directories.