linux命令学习(345)-which,whereis,locate
原创
©著作权归作者所有:来自51CTO博客作者chinalscxc的原创作品,请联系作者获取转载授权,否则将追究法律责任
【命令名称】:which
【使用权限】 所有人
【功能说明】:寻找可执行文件
【语法】:
which [-a] command
【常用参数】:
-a 将所有同PATH目录中可以查到的命令全部列出,而不是第一个找到的
命令
【实例】:
[root@cxcserver ~]# which passwd #查找passwd可执行文件
/usr/bin/passwd
【命令名称】whereis
【使用权限】 所有人
【语法】
whereis [-bmsu] 档案或目录名
【功能说明】 寻找指定文档
【常用参数】
-b #只找二进制文档
-m #只查找manual路径下的文件
-s #只查找source下的
-u #查找以上三个找不到的文件档案
【实例】
#全部显示
[cxc@cxcserver ~]$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
#只显示二进抽文件
[cxc@cxcserver ~]$ whereis -b ls
ls: /bin/ls
[cxc@cxcserver ~]$
【命令名称】locate
【使用权限】 所有人
【语法】 locate [-ir] 字段名
【功能说明】 也是查找文件,把包含字段名的文件名全部出来,这个东西还是有使用上的限制,这是因为 locate 寻找的资料是由/var/lib/mlocate/,当天每天都会更新,也可以手动更新,直接输入updatedb
【常用参数】
-i #忽略大小写
-r #后面可跟正则表达式
【实例】
#查找最后是passwd文件
[cxc@cxcserver ~]$ locate -r passwd$
/etc/passwd
/etc/pam.d/passwd
/etc/security/opasswd
/usr/bin/RSA_SecurID_getpasswd
/usr/bin/gpasswd
/usr/bin/htpasswd
/usr/bin/passwd
/usr/bin/smbpasswd
/usr/bin/userpasswd
/usr/bin/yppasswd
/usr/kerberos/bin/kpasswd
/usr/lib/news/bin/auth/passwd
/usr/lib/news/bin/auth/passwd/ckpasswd
/usr/sbin/chpasswd
/usr/sbin/lpasswd
/usr/share/doc/nss_ldap-253/pam.d/passwd
[cxc@cxcserver ~]$
上一篇:linux命令学习(1)-awk

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux which/whereis/locate命令详解
Linux which/whereis/locate命令详解
Linux命令 常用命令 数据库 linux -
which、whereis、locate
which;whereis
linux 命令 -
Linux 命令中 which、whereis、locate 命令的用法。
Linux 命令中 which、whereis、locate 命令的用法。
linux which whereis -
Linux下的查找命令locate find which whereis
Linux下的查找命令locate find which whereis
locate find which wh