via:https://www.debugpoint.com/whereis-command-linux/ 作者:Arindam选题:lkxed译者:geekpi校对:wxy 本文由LCTT原创编译,Linux中国荣誉推出
(2)whereis [-bmsu] filename1 filename2 ... 作用:locate the binary, source, and manual page files for a command.即:定位/返回与指定名字匹配的二进制文件、源文件和帮助手册文件所在的路径。 原理:whereis命令首先会去掉filename中的前缀空格和以.开头的任何字符,然后再在数据库(var/lib/slocate/sloca...
Linux 下查找相关命令主要有以下 4 个:which、whereis、locate、find。 (1)which[-a] cmdname1 cmdname2 … 作用:locate a command,从环境变量 PATH 中,定位 / 返回与指定名字相匹配的可执行文件所在的路径 原理:执行 which 命令时,which 会在当前环境变量 PATH 中依次寻找能够匹配所找命令名字的可执行文件...
https://www.computerhope.com/unix/uwhereis.htm https://linuxize.com/post/whereis-command-in-linux/ https://www.runoob.com/linux/linux-comm-whereis.html 1. 2. 3.
command | grep -E pattern 实例 从ps -ef 的输出结果中匹配 "b.*h" [vagrant~] ]$ps -ef | grep -E "b.*h" root 9 2 0 00:23 ? 00:00:00 [rcu_bh] root 431 1 0 00:23 ? 00:00:00 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases et...
-exec command:command 为其他指令,-exec 后面可再接额外的指令来处理搜寻到的结果。 -print :将结果打印到屏幕上,这个动作是默认动作! 范例八:将上个范例找到的文件使用 ls -l 列出来~ [root@study ~]# find /usr/bin /usr/sbin -perm /7000 -exec ls -l {} \; ...
while the tests don't do anything until files are examined. The-daystart,-followand-regextypeoptions are different in this respect, and have an effect only on tests which appear later in the command line. Therefore, for clarity, it is best to place them at the beginning of the expression...
然后 whereis 尝试在标准 Linux 位置以及 PATH和MANPATH 指定的位置中定位所需的程序。 选项 -b 只搜索二进制文件。 -m 只搜索手册文件。 -s 只搜索源文件。 -u 只展示有特殊条目的命令名称。如果一个命令对于每个明确请求的类型不只有 一个条目,则称该命令是不寻常的。因此 “whereis -m -u *” 请求在...
作用:locate a command,从环境变量PATH中,定位/返回与指定名字相匹配的可执行文件所在的路径 (2)...
whereis 可以查找指定命令的二进制文件、源文件和帮助文件。 被找到的文件在显示时,会去掉主路径名,然后再去掉文件的(单个)尾部扩展名 (如: .c),来源于源代码控制的 s. 前缀也会被去掉。接下来,whereis 会尝试在标准的 Linux 位置里寻找具体程序,也会在由 $PATH 和 $MANPATH 指定的路径中寻找。