Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Graphics Administration Guide: HP 9000 Workstations and Servers > Chapter 2 Pathnames

Using "whence"

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

There are two main methods of finding files, assuming you know the name of the file you're looking for. The first method is to use the Korn-shell command whence, which tells you where commands reside (if you're not using the Korn shell, you can use the system command whereis):

$ whence
mknod Return
/etc/mknod

The above approach, while satisfactory in many cases, has two limitations:

  • First, 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 still valuable, though: you may not remember which, of the dozens of directories that may be in your PATH variable, is where a particular command resides. Also, if you have two commands of the same name in two different directories, whence and whereis will tell you which one will be found first, and thus executed.

  • Secondly, both whence and whereis only find executable files; that is, commands (both compiled programs and shell scripts). If you want to find a file that is not executable — an include file, for instance — whence and whereis will not find it, even if the include file's directory is in your PATH. To find non-executable files, you can use find, discussed below.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1996 Hewlett-Packard Development Company, L.P.