What Linux command would you use to figure out the path of an executable file?
- where
- what
- which
- wexec
EXPLANATION
Find the correct path to an executable file in Unix
whereis
command
to find where programs, or executables, are stored in the file
structure of the computer. To use it at the Unix prompt, enter:whereis commandReplace
command
with the name of the executable for which
you are looking. For example, if you are looking for the location of
the lpr command, you would enter:whereis lprThe
whereis
command will return something like the
following:lpr: /usr/ucb/lpr /usr/man/man1/lpr.1In this example, the query asked about the
lpr
command,
which spools jobs to printers. The operating system returned two
answers, and thus two paths. The first path is the location of the
lpr
executable, and the second path is the location of
the lpr
manual page.To find the path the operating system uses to execute a command when you enter it on the command line, use the
which
command instead, for example:which lprThis command will output something like the following:
/var/bsd/lprThis means that when you enter
lpr
at the command line,
the system is really executing /var/bsd/lpr
.
0 comments:
Post a Comment