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):

  1. Create the following subdirectories:

    cars
    cars/honda
    cars/gm
    cars/toyota
    cars/ford
    
  2. Create 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/corvette
    
../_images/h01_1.png

When 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 DONEon 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 the touch command to create empty files (the syntax is touch [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.

  1. ~/class

  2. ../../../

  3. ../../

  4. /home

  5. ~/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:

  1. you have installed the files from h01.tar.gz.

  2. your current working directory is ~/class/h01/q03,

  3. you completed question 1 correctly, and

which of the following pathnames refers to an existing file?

  1. ~/class/done.sh

  2. ../q01/cars

  3. /class/h01

  4. ../a03.txt

  5. /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.

  1. The computer used for the www.mst.edu web server

  2. Updating the student directory information

  3. The MST webmaster

  4. The MST network used to access www.mst.edu

  5. 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.

  1. /

  2. /var/log

  3. h01/q03/a03.txt

  4. /home/st01/class/h01

  5. ../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