Difference between revisions of "Which"

From Linuxintro
imported>ThorstenStaerk
(Created page with "The command which is an easy way to find out where an executable program comes from. As an example: * open a console * Find out where ls, which and alias...")
 
imported>ThorstenStaerk
 
Line 11: Line 11:
 
  which: no alias in (/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:/usr/lib/qt3/bin)
 
  which: no alias in (/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:/usr/lib/qt3/bin)
 
</pre>
 
</pre>
in the case of alias we find out it is a [[shell builtin]].
+
in the case of alias we find out it is a [[shell builtin]]. You can find this out using the [[command]] [[type]]:
 +
<pre>
 +
tweedleburg:~ # type alias
 +
alias is a shell builtin
 +
tweedleburg:~ # type which
 +
which is hashed (/usr/bin/which)
 +
tweedleburg:~ # type ls
 +
ls is aliased to `ls $LS_OPTIONS'
 +
</pre>
  
 
= See also =
 
= See also =
 +
* [[type]]
 
* [http://unixhelp.ed.ac.uk/CGI/man-cgi?which man page of which]
 
* [http://unixhelp.ed.ac.uk/CGI/man-cgi?which man page of which]

Latest revision as of 09:15, 11 June 2011

The command which is an easy way to find out where an executable program comes from. As an example:

 tweedleburg:~ # which ls
 /bin/ls
 tweedleburg:~ # which which
 /usr/bin/which
 tweedleburg:~ # which alias
 which: no alias in (/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:/usr/lib/qt3/bin)

in the case of alias we find out it is a shell builtin. You can find this out using the command type:

tweedleburg:~ # type alias
alias is a shell builtin
tweedleburg:~ # type which
which is hashed (/usr/bin/which)
tweedleburg:~ # type ls
ls is aliased to `ls $LS_OPTIONS'

See also