which
which功能说明:查找文件。
语 法:which [文件...]
补充说明:which指令会在环境变量$PATH设置的目录里查找符合条件的文件。
参 数:
-n<文件名长度> 指定文件名长度,指定的长度必须大于或等于所有文件中最长的文件名。
-p<文件名长度> 与-n参数相同,但此处的<文件名长度>包括了文件的路径。
-w 指定输出时栏位的宽度。
-V 显示版本信息。
which
which [options] [--] [commands]
List the full pathnames of the files that would be executed if the named commands had been run. which searches the user's $PATH environment variable.
Options
Print all matches, not just the first.
Read aliases from standard input and write matches to standard output. Useful for using an alias for which.
Read shell functions from standard input and report matches to standard output. Useful for also using a shell function for which itself.
Ignore --read-alias if present. Useful for finding normal binaries while using --read-alias in an alias for which.
Skip directories that start with a dot.
Ignore --read-functions if present. Useful when searching for normal binaries while using --read-functions in an alias or function for which.
Skip directories that start with a tilde (~) and executables in $HOME.
If a matching command is found in a directory that starts with a dot, print ./cmdname instead of the full pathname.
Print a tilde (~) to indicate the user's home directory. Ignored if the user is root.
Stop processing options on the right if not on a terminal.
Print version information and then exit.
Print help information and then exit.
Example
$ which cc ls /usr/bin/cc ls: aliased to ls -sFC