Which
From FreeBSDwiki
(Difference between revisions)
m (Reverted edits by 82.114.160.35 (Talk); changed back to last version by Jimbo) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | '''which''' is a very useful system command used to [[find]] out exactly what is going to get executed when you ask for a command without specifying a path. For instance, the [[csh]] shell has a [[built-in]] function called [[time]], but there is also a version at '''/usr/bin/time'''. So '''which''' one gets executed if you simply type "time"? | |
− | + | ph34r#''' which time''' | |
− | + | time: shell built-in command. | |
− | ''' | + | ph34r# |
+ | |||
+ | This is particularly useful to know in the case of the [[time]] command above, because [[csh]]'s [[built-in]] "time" does not have the same featureset described in the [[man]] page for [[time]], which is based on the version to be found at '''/usr/bin/time'''. | ||
See also [[where]] for figuring out how many different versions of the same command or file you have strewn throughout your [[path]]. | See also [[where]] for figuring out how many different versions of the same command or file you have strewn throughout your [[path]]. | ||
[[Category:System Commands]] | [[Category:System Commands]] |
Latest revision as of 12:44, 19 November 2007
which is a very useful system command used to find out exactly what is going to get executed when you ask for a command without specifying a path. For instance, the csh shell has a built-in function called time, but there is also a version at /usr/bin/time. So which one gets executed if you simply type "time"?
ph34r# which time time: shell built-in command. ph34r#
This is particularly useful to know in the case of the time command above, because csh's built-in "time" does not have the same featureset described in the man page for time, which is based on the version to be found at /usr/bin/time.
See also where for figuring out how many different versions of the same command or file you have strewn throughout your path.