1.2. Chapter Review
1.2.1. Creating Directories and Files
Within your ~/class/h01/q01 directory, create the following directory structure and files (see the directory structure below):
Create the following subdirectories:
cars cars/honda cars/gm cars/toyota cars/fordCreate the following files in the subdirectories:
cars/honda/accord cars/honda/odyssey cars/toyota/prius cars/toyota/camry cars/ford/f150 cars/ford/focus cars/gm/equinox cars/gm/corvetteWhen you have completed this activity, you can run the program check01.sh to check your work. Run it by issuing ./check01.sh. (# “.” means the current directory while “/” is a delimiter/separator. ./check01.sh tells the Unix-like operating system to run the specified executable script in the current directory.) Once you are satisfied that everything is correct, enter the word DONEon the line starting with “A.”in h01/q01/a01.txt. Leave a space after “A.” and before “DONE”.
Note
We use the
mkdir
(“make directory”) command to create directories and thetouch
command to create empty files (the syntax istouch [filename]
). Issue the command in the appropriate directory).
1.2.2. Change Directory
Navigating around directories in the Linux file system (the Linux filesystem directory structure). Within the h01/q02 directory, which of the following pathnames will move you to your home directory when using the cd (change directory) command before it? Assuming your class directory is located in your user home directory and you are starting in your class/h01/q02 directory.
~/class
../../../
../../
/home
~/class/..
Record your answers in h01/q02/a02.txt. Enter T for those that do, and F for those that don’t. Leave a space after the dot and before T and F.
Note
By your home directory we are referring to the user home directory of the current logged in user, not the system home directory (/home) that contains all the user home directories.
CTL+O in nano: It’s convenient to open and tile two terminals so you can test out the command and path in one and record your answers at the same time in the other. When doing so, you would want to save the file being edited by using CTL+O in nano to save the file without exiting.
cd tricks: cd - will bring you back to the previous directory that you were in and cd ~ or simply cd will bring you back to your user home.
1.2.3. Listing Files
Assuming that:
you have installed the files from h01.tar.gz.
your current working directory is ~/class/h01/q03,
you completed question 1 correctly, and
which of the following pathnames refers to an existing file?
~/class/done.sh
../q01/cars
/class/h01
../a03.txt
/home
Record your answers in h01/q03/a03.txt. Enter T for those that are existing files, and F for those that are not existing files.
Note
In Linux, directories are considered as files. See tldp.org [1]: “On a UNIX system, everything is a file; if something is not a file, it is a process.”
It is suggested that you use the command ls to perform this task although you may use cd to navigate to the directories and then ls to check if the file exists.
1.2.4. Resource vs. Process
Identify each of the following as either an information system resource or process for the MST website by entering either Resource or Process after the corresponding letter.
The computer used for the www.mst.edu web server
Updating the student directory information
The MST webmaster
The MST network used to access www.mst.edu
Creating the MST News and Events stories
Record your answers in h01/q04/a04.txt.
Note
Tell the difference between organizational resources and processes
1.2.5. Full/Absolute Path vs. Relative Path
For each of the pathnames given below, answer T if the pathname is an absolute(full) path; answer F if the entry is a relative pathname.
/
/var/log
h01/q03/a03.txt
/home/st01/class/h01
../q02
Record your answers in h01/q05/a05.txt.
Note
Absolute (Full) Path and Relative Path in Linux file system are two ways to specify a file. An absolute (full) path has an absolute reference point, the root directory: /
Footnotes