lostAstronaut
lostAstronaut

Reputation: 1361

where command not found os x

Okay so the title is pretty self explanitory, when I type where ... as a command it returns

-bash: where: command not found

my current bash profile includes :

export PATH="/usr/local/lib:$PATH"
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/lib/node_modules/bin:$PATH"

I googled it for a while and found that most people just need /usr/bin and /usr/sbin which I have both of.

Any ideas?

Upvotes: 10

Views: 24545

Answers (2)

Keith Thompson
Keith Thompson

Reputation: 263497

As Stuart says, where is a tcsh builtin command. It's an extended version of the which command; which tells you what a command name resolves to, and where shows a list of all the places (including aliases, builtins, and executables in $PATH) where a command might be found.

The bash equivalent is type -a.

If you like, you can add this function definition to your .bashrc or .bash_profile:

where() { type -a "$@" ; }

The output isn't in exactly the same format, but it gives you the same information.

(Or you might consider just re-training yourself to use type -a rather than where.)

Upvotes: 13

Stuart
Stuart

Reputation: 574

"where" is a shell builtin for csh. Is that what you're really looking for?

"which" and "whereis" are under /usr/bin, and tell you where to find a given command.

Upvotes: 23

Related Questions