6

I recently came across the command where, which provides the actual path of executables in Linux. I was aware of which, whereis, locate and find, but not where.

I want to know when this command got introduced and why its manual is not available. Is this shell command specific to the C Shell or do all shells have the where command?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175

3 Answers3

6

The only shells I know which has a builtin command called where is the tcsh and zsh. In the manual page of that shell (man tcsh / man zshbuiltins), you can find the definition:

   where command (+)
           Reports all known instances of command, including aliases, builtins and
           executables in path.

Therefore it is the tcsh-equivalent of the bash builtin type (tcsh has no type):

tcsh$ where where
where is a shell built-in
tcsh$ where echo
echo is a shell built-in
/bin/echo
chaos
  • 47,463
  • 11
  • 118
  • 144
5

where is a shell builtin command in csh

    where where
    where is a shell built-in

the builtin is also available in zsh.

fd0
  • 1,430
  • 1
  • 10
  • 14
2

The linux command is called which. If you are used to in c-shells this might be a builtin. Bash builtins are documented through the bash builtin help.

From Wikipedia:tcsh

The built-in where command. Works like the which command but shows all locations of the target command in the directories specified in $PATH rather than only the one that will be used.

So I'm right: The where command is a tcsh built-in and not available as an external command. If you pay me 250$ I will write a little C command for you ;)

ikrabbe
  • 2,155
  • 12
  • 20
  • No, the Linux command is `type` in Bourne-style shells (including bash, which is usually the default interactive shell on Linux) and `which` on csh. `which` also exists as an external command, but [should not be used outside (t)csh since it's unreliable](http://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then). – Gilles 'SO- stop being evil' Jul 01 '15 at 21:45