Lab 7

Back Up Next

horizontal rule

Home
Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Lab 7
Lab 8
Lab 9
Lab 10
Lab 11
Lab 12
Lab 13
Lab 14
Lab 15
Lab 16
Lab 17
Lab 18
Lab 19
Lab 20

Lab 7

(Chapter 7)

 

 


 

Learning Objectives

1.      To learn how to create a UNIX file structure (i.e., directory hierarchy)

2.      To learn about absolute and relative pathnames

3.      To learn about home directory, login directory, and present working directory (also known as the current directory)

4.      To learn how to effectively navigate the UNIX directory hierarchy

5.      To learn about file types and hidden files

6.      To learn about the file attributes

 

Lab Work

Most of the work you will do in this lab will be related to the following directory hierarchy.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 


     

  1. Log on to your UNIX system
  2. Build the above directory hierarchy under your home directory, labeled as YHD Figure Lab7.1. Capture below the whole shell session you needed to complete this work. Include commands and their outputs in the session reproduced below.
     
  3. Display the absolute pathname of your login directory.

 

 

  1. Suppose that after login, you execute the cd professional/courses command. Answer the following questions.
    1. What is the absolute pathname of your home directory? Show the command that you used to obtain the answer to this question, along with the command output.

 

 

 

b.      What is the absolute pathname of the ‘acm’ directory?

 

c.       Give two relative pathnames for the ‘acm’ directory.

 

 

 

d.      Execute the cd major/cs381/labs command. Now execute a command to display the absolute pathname of your current directory. Show your session.

 

 

 

e.       Give three different commands to get back to your home directory.

 

 

  1. Change directory to /usr. How many files and directories are there in this directory? What are the types of the files?

 

 

 

  1. How many ordinary files, directories, and link files exist in the /usr/bin directory? How did you obtain your answer? What are the names of directories?

 

 

 

  1. When you log on, your UNIX system displays a message before displaying the shell prompt. This message, called “message of the day,” is stored in the motd file under the /etc directory. Display this message and capture your session below.

 

 

 

  1. The /etc directory also contains a file that contains attributes for all the users who have accounts on the system. A line in this file describes the user. What is the name of this file? Display the line for yourself and display the session below. Also write down the following information about yourself: user name, user ID, group ID, personal information, home directory, and login shell.

 

 

 

 

 

  1. What directory on your system contains the UNIX kernel executable and other files and directories related to the UNIX kernel? Write down the name of the executable kernel code.

 

 

 

  1. In UNIX jargon, hidden files are those files whose names start with a dot (.) such as .profile. Locate the .profile or .login file on your system. Where did you find it? Partially show the contents of the file.

 

 

 

 

 

  1. Show names of all hidden files in your home directory. Show your session.

 

 

 

  1. What are the inode numbers of the following directories on your system: root, your home directory, ~/temp, ~/professional, and ~/personal? Capture the session that you had on your system to get your answers.

 

 

 

 

 

 

  1. Display the type of contents of the file that contains the executable code for your UNIX kernel. Show your session.

 

 

 

  1. Use a text editor to create a file called lab1 under the labs directory in your directory hierarchy. The file should contain the text of this problem. Answer the following questions:
    1. What is the type of lab1? Use a UNIX command to answer the question and capture your shell session below.

 

 

 

 

    1. What is the type of contents of lab1? Use a UNIX command to answer the question and capture your shell session below.

 

  1. Header files in UNIX have .h extension. Display the names of all header file in the /usr/include/sys directory that start with the letter ‘t’. Show your session.

 

 

  1. Log out.

 


 

 

horizontal rule

Back to CS140U Homepage
This page was last modified September 26, 2004
wmorales@pcc.edu