Prev | Current Page 785 | Next

Michael McCallister

"openSUSE Linux Unleashed"


Let??™s review this command next.
Using which
The which utility is a handy command for finding the executable files used by system
commands. The which utility searches for files in a manner similar to the find utility.
However, which searches for files only in the directories contained in the PATH variable.
At this point, you??™ve probably noticed that you can run system commands, such as which,
locate, find, cp, rm, and cd, regardless of what your current directory in the file system
is. That??™s because the executable files for these commands reside in directories that are
included in the PATH variable. You can see a listing of these directories by entering echo
$PATH at the shell prompt, as shown in Figure 18.8.
FIGURE 18.8 Viewing directories in the PATH variable.
The which utility is used to generate a search that is limited to the directories in the PATH
variable. For example, if you wanted to find out where the cp executable resides, you
would enter the following:
which cp
The which utility then returns the path where cp is located, as shown in Figure 18.


Pages:
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797
news news news news news