Assuming I'm writing in Terminal: 'ctags', how can I know the full path of the command 'ctags?
$ type ctags ctags is /usr/bin/ctags $ type -p ctags /usr/bin/ctags
The second form is useful for doing things like
$ file $(type -p ctags) $ ls -l $(type -p ctags)
and is often aliased to
If you don't want to rely on
bash functionality and prefer an external command,
/usr/bin/whereis serves a similar purpose:
The whereis utility checks the standard binary directories for the specified programs, printing out the paths of any it finds.
whereis doesn't use
$PATH but rather the result of
sysctl user.cs_path it may lead to different results.
Type the command as a parameter, for e.g. to find location of
ls -l $(which tar)
which in my case returns
lrwxr-xr-x 1 root wheel 6 Jul 26 2012 /usr/bin/tar -> bsdtar