If you use the bash builtin type, it will show you all the (in-path) locations for a command:
$ type -a ls
ls is aliased to `ls --color=always'
ls is /bin/ls
$ type -a printf
printf is a shell builtin
printf is /usr/bin/printf
$ type -a touch
touch is /usr/bin/touch
touch is /bin/touch
If the command is a function, it will list the function definition:
$ type -a somefunc
somefunc is a function
somefunc ()
{
echo "hello, world"
}
These examples are from a Ubuntu system, but the results will be similar for OS X.
It depends on what you're looking for. Most of the utilities depend on the path variable. However, if what you're looking for is in your path chances are you don't really need to know where it is unless there are multiple copies of the same executable.
This doesn't apply to most things running in OSX though because they aren't run quite like normal linux/unix binaries. Here are some methods to find things that aren't in your path statement.
find:
sudo find / -name <FILE>
This will find anything that exists on the file system you give as the first argument. It need to run as root to search private directories. It also supports wildcards if you're not completely sure of the name.
Terminal:
If you have the file in finder you can open a terminal window and drop the file into it. Terminal with then display the full path to the file.
Spotlight:
Pretty self explanatory. You're donating processor cycles to allow it to keep an index of your fi
which
will search your path for the arguments you supply, it's found on just about any BSD or SysV UNIXIf you use the bash builtin
type
, it will show you all the (in-path) locations for a command:If the command is a function, it will list the function definition:
These examples are from a Ubuntu system, but the results will be similar for OS X.
try 'locate identify'
It depends on what you're looking for. Most of the utilities depend on the path variable. However, if what you're looking for is in your path chances are you don't really need to know where it is unless there are multiple copies of the same executable.
This doesn't apply to most things running in OSX though because they aren't run quite like normal linux/unix binaries. Here are some methods to find things that aren't in your path statement.
find:
sudo find / -name <FILE>
This will find anything that exists on the file system you give as the first argument. It need to run as root to search private directories. It also supports wildcards if you're not completely sure of the name.
Terminal:
If you have the file in finder you can open a terminal window and drop the file into it. Terminal with then display the full path to the file.
Spotlight:
Pretty self explanatory. You're donating processor cycles to allow it to keep an index of your fi