• No results found

The lost+found Directory

In document Rehman_HP (Page 101-104)

Chapter review questions

Chapter 7. File Permissions Chapter Syllabus

8.13 The lost+found Directory

These files are usually created by the fsck command, which is used to check file system integrity from time to time and at boot time. The files that have no valid links are copied to this directory. Each file system contains one lost+found directory.

Study Break

HP-UX Directory Tree

It is useful to have a look at your HP-UX system at this point. Log into HP-UX and try to construct a three-level directory tree. The first level is the root

directory. All directories under the root directory are placed in the second level. In the third level, list all other directories found inside the directories at the second level.

8.14 Some Useful Commands Related to File System Hierarchy

If you understand file system hierarchy, it will not be difficult for you to find a file in UNIX. However, there are some useful commands to help you in your file search.

The which Command

If you want to find out in which directory an executable file or command is located, you can use the which command. For example, if you want to see in which directory the ls command is located, use the following procedure.

$ which ls /usr/bin/ls $

The which command finds all files that are located in your search path. The whereis Command

Another command is whereis, which can search and locate source, binary, and manual pages. The following command shows two files that can be used as the cat command and the path to the manual page for the command.

$ whereis cat

cat: /sbin/cat /usr/bin/cat /usr/share/man/man1.Z/cat.1 $

More on the man Command

You can also use the man -k command to search all man pages related to a keyword. The command below searches man pages and shows all commands related to mkdir.

$ man -k mkdir

dosmkdir(1) - make a DOS directory mkdir(1) - make a directory

mkdir(2) - make a directory file

mkdirp(), rmdirp()(3G) - create, remove directories in a path nis_server, nis_mkdir, nis_rmdir, nis_servstate, nis_stats, nis_getservlist, nis_freeservlist,

nis_freetags(3N) - miscellaneous NIS+ functions nismkdir(1) - create NIS+ directories stmkdirs(1) - Utility to build Scalable Type fonts.dir and charsets.

dir files $

Before you can use this command, you must create the /usr/share/lib/whatis file using the catman command. This file contains a list of all manual pages, with a short description of each command.

In the above listing generated by the man -k mkdir command, you can see that there is a number specified in parentheses after the name of a command. This number shows the section of the manual pages in which that entry is found. For example, you can see that both sections 1 and 2 contain a manual entry for mkdir. When you use the man mkdir command, the first manual page found by the man command is displayed. If you want to display a particular manual page, you need to specify the section as the argument to the man command. As an example, to display the manual page for mkdir in Section 2, you need to use the man 2 mkdir command instead of man mkdir.

Chapter Summary

In this chapter, you looked into the file system hierarchy of HP-UX. Now you know how different files and directories are arranged in the file system and which directories contain what types of files. Specifically, we studied the following concepts:

• Difference of static and dynamic parts of the file system. The static part contains those files and directories that don't change after installation of HP-UX. On the other hand, the dynamic part of the file system contains those files and directories that can change from time to time. The static directories are also called shared directories because these can be shared among many systems on a network.

• Arrangements of directories relative to root directories.

• Types of files contained in each directory.

• Directories that contain files related to HP-UX system administration.

• Directories where log files reside.

• Directories containing commands and other executable files.

• Place of installation of additional applications.

• Directory where the HP-UX kernel resides.

• Place of files and directories needed for system startup and shutdown.

In addition, you also use some commands to find particular types of files in HP-UX. You again used the man command and had an introduction to the sections of the manual pages.

I am of the strong opinion that if you understand the file system hierarchy well, half of the system administration task is done. This is the most important chapter in the first part of the book and you may need to have a look at it from time to time until you feel everything is at your fingertips.

Chapter Review Questions

1: Why are static directories also called shared directories?

2: If you install a new application on the system, where would you like to place its files? What is the recommended place for its configuration and log files?

3: What is the use of the /tmp directory?

4: What are spool files and where are they placed in the HP-UX file system hierarchy?

5: What are device files and how are they arranged?

6: What is the relation between physical disks and the directory structure of HP-UX?

7: What is the difference between the whereis and which commands? Test Your Knowledge

It is an executable program. It is a configuration file. It is a log file.

It is a spool file.

2: The HP-UX file system hierarchy is based on:

Berkley distribution (BSD). AT&T SVR4.

a logical arrangement of files and directories, not based on BSD or AT&T SVR4. a random distribution of files and directories.

3: Mail files are kept in which directory?

/mail

/var/spool/mail /home/mail /var/mail

4: What is true about the lost+found directory?

There is only one lost+found directory in a system.

There are as many lost+found directories as the number of file systems. Common users create files in this directory if they find any file lost by another user.

The system administrator creates files in it that announce the finding of lost files so that a user who lost a file can retrieve it from there.

5: To find a command in the search path, we use the command:

whatis which whois find

6: Which directory contains programs needed at boot time?

/sbin /usr/sbin /startup /etc

7: The HP-UX kernel is located in:

/kernel /var/kernel /usr /stand

Chapter Syllabus

9.1 POSIX Shell Capabilities

In document Rehman_HP (Page 101-104)