McMullin Questions Chapter 3
3.1 The Directory Hierarchy 3.1.1 Describe the Directory Hierarchy a) What is the root directory? b) What is the root directory's path name? c) How does a relative path name differ from an absolute path name? d) What is the .. directory? 3.1.2 Interpret Absolute Path Names The path name /etc/passwd is interpreted as: The root directory contains the directory etc, which contains the passwd file. Interpret the following path names: a) /usr/john/../janet b) ~/directory/ c) ~/janet 3.1.3 Interpret Relative Path Names Interpret the following path names: a) books/recipes/../drama b) ./-o c) ./../... 3.1.4 Multiple Choice Assume you have the directories: /pubs/guides/user and /pubs/reference/manual 1) What directories are siblings? a) pubs and pubs b) guides and reference c) user and manual 2) What is the parent of the user directory? a) guides b) pubs c) reference 3) What is the child of the reference directory? a) pubs b) manual 4) If your current directory is /pubs/guides/user, which of the following relative path names refers to /pubs/reference? a) ./././reference b) ../../reference c) ../../../reference 3.2 Rules for File Names 3.2.1 List Name and Path Maximum Lengths Type the following command: getconf NAME_MAX . a) What is the result? b) What does it mean? Type the following command: getconf PATH_MAX . c) What is the result? d) What does it mean? e) How many directories can be in a path name? 3.2.2 Identify Valid File Names In your current directory, use file redirection to create files with the following names and record your results. a) supercalifragilisticexpialidocious b) and/or c) a\ file d) /dev/null e) A f) a g) .text.file 3.2.3 List Hidden Files Use the commands: ls, ls -a, ls -A to view the contents of your home directory. a) What do these commands do? b) How can you hide a file? 3.2.4 Multiple Choice Which of the following Characters cannot be included in a file's name? a) space b) tab c) End-Of-Line d) \ e) / 3.2.5 True or False? 1) A File Name beginning with dot (.) must not contain any other dots. 2) The maximum length of a file name is always 14 characters 3) The getconf command returns information about system limits 4) You can create a file named dot-dot (..) 3.3 Information About Files 3.3.1 List File Information Use the following listing to answer the questions in this exercise: -rw-rw-rw- 1 bob acctg 1039 Mar 15 09:58 back -r--r--r-- 2 jan acctg 959 Apr 1 01:02 keep -r--r--r-- 2 jan acctg 959 Apr 1 01:02 save -rwxrw---- 1 bob acctg 100 May 1 12:15 store dr-xr-xr-x 2 root wheel 512 Jun 1 1997 zip a) What command was used to get this listing? b) Which entry is a directory? c) What user and group owns the file back? d) When was the file keep last modified? e) How many names (links) does the file keep have? f) If keep has more than one link, which of the names is the file's other name? g) Which entry has gone unchanged the longest? 3.3.2 Recognize Types of FIles a) In an ls -l listing, what character would indicate a directory? b) What's the difference between a soft link and a hard link? c) In an ls -l listing, what does the character "l" at the beginning of an entry mean? 3.3.3 True or False? 1) Every user has only one group. 2) You cannot make a hard link to a directory. 3) The ls command can only show one time, the modification time. 3.3.4 Matching Match the character from the ls -l listing with the file type: a) Ordinary File i) l b) Symbolic Link ii) d c) Directory iii) - d) Block Special file iv) b 3.4 File and Directory Permissions 3.4.1 Read File Permissions Use the following listing to answer the questions in this exercise: -rw-rw-rw- 1 dana tech 9129 Mar 13 19:00 grab -r--r--r-- 2 jim pubs 19026 Apr 21 21:29 hold -rwxrw---- 1 dana tech 87695 May 17 07:57 invest dr-xr-xr-x 2 root wheel 512 Jun 1 1997 zip a) If you are not users dana, jim or root, and you are not a member of tech, pubs, or wheel groups, which file can you change? b) As in part a), Which file can you not read? c) As in part a), Can you make zip your current directory? d) If you are not root or a member of the wheel group, can you create files in the zip directory? e) Which files can user jim edit? f) Which files can user jim change permissions? 3.4.2 Understand your Default Permissions a) If you create a file in a directory with mode 664, what are the permissions on the file? b) What does the umask command do? 3.4.3 Change File Permissions In your home directory, create the file notebook.txt Type the following command: chmod 664 notebook.txt a) What does ls -l show the permissions to be? Type the following command: chmod a-x notebook.txt b) What does the command do? Type the following command: chmod u+x,g+x notebook.txt b) What does the command do? d) What command would change the permissions on the file to: rw-rw-r-- ? 3.4.4 Change Directory Permissions In your home directory, type the following commands mkdir workbook.examples chmod ag=rwx,o=r workbook.examples a) What does ls -ld show the permissions to be? Type the following commands chmod a-x workbook.examples cd workbook.examples b) What happens? Why? Type the following commands chmod u+x,g+x workbook.examples cd workbook.examples c) What happens? Why? 3.4.5 True or False 1) You can create a directory you can cd into, but not list its contents. 2) When you change permissions on a directory, you also change the permissions on every file in that directory. 3) You can chmod any file that belongs to your group. 3.4.6 Multiple Choice 1) A file is mode 777. After a chmod u=rw command, its file mode is which of the following? a) 644 b) 766 c) 677 d) 600 e) 776 3.5 Perhaps harder questions 1) On a system where the maximum size of a path name is 4096 characters and the maximum size of a file name is 255 characters: a) What's the largest number of directories in a path name? b) What's the smallest? 2) How might you find out whose home directory uses the most space on the system? 3) What are the security advantages of groups?
Questions? Robert Katz: rkatz@ned.highline.edu