[Ilugc] One Day One GNU/Linux Command (WHEREIS)

  • From: raamanp@xxxxxxxxxxx (Raman.P)
  • Date: Fri Aug 8 10:00:41 2008

--- On Thu, 7/8/08, Sivakumar Gopalan <sivakumar@xxxxxxxxxx> wrote:

Just a thought. Here is the difference between whereis,
locate and which

whereis - can find any file, but looks only in standard
locations.

locate - can find any file from any location, however there
should be a
locatedb update run frequently to have accurate results.

which - can find executables which are in the path
variable.

A similar command is type. It is shell builtin. Very fast, searches in $PATH 
but only executables. e.g
 type ls

A comparison with which

$ time which ls
alias ls='ls --color=tty'
        /bin/ls

real    0m0.016s
user    0m0.000s
sys     0m0.010s
$ time type ls
ls is aliased to `ls --color=tty'

real    0m0.000s
user    0m0.000s
sys     0m0.000s

Raman.P


      Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/

Other related posts: