Linux中的which和whereis
作者:互联网
which和whereis
- 系统中常用which和whereis来查找命令的位置
- which比where更直白和简洁的定位到程序的位置
- whereis比which显示的更丰富,可以同时显示帮助及二进制文件
[二 3月 23 23:19:43 root@C8-3-55 ~ ]# which yum
/usr/bin/yum
[二 3月 23 23:49:13 root@C8-3-55 ~ ]# whereis yum
yum: /usr/bin/yum /etc/yum /etc/yum.conf /usr/share/man/man8/yum.8.gz
whereis
[二 3月 23 23:49:21 root@C8-3-55 ~ ]# whereis --help
用法:
whereis [选项] [-BMS <dir>... -f] <名称>
定位某个命令的二进制文件、源码和帮助页文件。
选项:
-b 只搜索二进制文件
-B <目录> 定义二进制文件查找路径
-m 只搜索手册和信息
-M <目录> 定义 man 和 info 查找路径
-s 只搜索源代码
-S <目录> 定义源代码查找路径
-f 终止 <目录> 参数列表
-u 搜索不常见记录
-l 输出有效查找路径
-h, --help display this help
-V, --version display version
更多信息请参阅 whereis(1)。
which
[二 3月 23 23:49:50 root@C8-3-55 ~ ]# which --help
Usage: /usr/bin/which [options] [--] COMMAND [...]
Write the full path of COMMAND(s) to standard output.
--version, -[vV] Print version and exit successfully.
--help, Print this help and exit successfully.
--skip-dot Skip directories in PATH that start with a dot.
--skip-tilde Skip directories in PATH that start with a tilde.
--show-dot Don't expand a dot to current directory in output.
--show-tilde Output a tilde for HOME directory for non-root.
--tty-only Stop processing options on the right if not on tty.
--all, -a Print all matches in PATH, not just the first
--read-alias, -i Read list of aliases from stdin.
--skip-alias Ignore option --read-alias; don't read stdin.
--read-functions Read shell functions from stdin.
--skip-functions Ignore option --read-functions; don't read stdin.
Recommended use is to write the output of (alias; declare -f) to standard
input, so that which can show aliases and shell functions. See which(1) for
examples.
If the options --read-alias and/or --read-functions are specified then the
output can be a full alias or function definition, optionally followed by
the full path of each command used inside of those.
Report bugs to <which-bugs@gnu.org>.
标签:help,23,--,read,whereis,yum,Linux 来源: https://blog.csdn.net/timonium/article/details/115169867