HP Workstation zx2000 HP Graphics Administration Guide for HP-UX 11.X (IPF ver - Page 7
path names, finding files with “whence” and “whereis”
View all HP Workstation zx2000 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 7 highlights
2 path names This chapter contains information on locating files that reside in the file system. finding files with "whence" and "whereis" There are two main methods of finding commands if you know the name of the command you're looking for. The first method is to use the Korn shell command whence, which tells you where a command resides. If you're not using the Korn shell, you can use the system command whereis. To use whence, enter: $ whence mknod The path for the command you're looking for is returned: /etc/mknod The above approach has two limitations: ■ Both whence and whereis only find executable files; that is, commands (both compiled programs and shell scripts). whence and whereis do not find non-executable files, even if they are in your PATH. To find nonexecutable files, use find, which is described in the next section. ■ The directory in which the command resides must be one of the entries in the PATH variable; if it is not, it won't be found. So in a sense, whence and whereis can only find things if you tell them where to look. They are valuable when a command is in your PATH but you do not remember where it is. Also, if you have two commands of the same name in two different directories, whence and whereis tell you which one will be found first, and thus executed. finding files with "find" The find command finds any file in your file system, executable or not. For example, to locate an include file, you would execute: $ find / -name '' where is the name of the file you're looking for. In this example, "/" is the root directory. If you specify the correct file name, and it is somewhere in the file system, the find command will find it, though it make take a while. You can shorten the search time by including a subdirectory. For example: find /opt -name '' searches only the /opt directory. You also can specify a partial filename. The find command locates all files that contain a specified substring in their names. find has many other options for refining a search; see the man page for details. Graphics Administration Guide 2-1