码迷,mamicode.com
首页 > 其他好文 > 详细

which、whereis、locate

时间:2018-07-27 12:15:24      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:--   ram   font   director   option   pass   ash   als   完整路径   

which命令:

shows the full path of (shell) commands

查看命令的完整路径,根据环境变量的PATH查找

语法:

which [options] [--] programname [...]

实例:

[root@www1 ~]# which passwd
/usr/bin/passwd
[root@www1 ~]#


whereis命令:

locate the binary, source, and manual page files for a command

查找命令的二进制文件、源码等

语法:

whereis [-bmsu] [-BMS directory...  -f] filename...

选项:

-b 只查找二进制文件

-f 只显示文件,不显示目录

-m 只查找文件说明文档

-s 只查找文件源码

实例:

[root@www1 ~]# whereis passwd
passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man5/passwd.5.gz /usr/share/man/man1/passwd.1.gz
[root@www1 ~]# whereis -m passwd
passwd: /usr/share/man/man5/passwd.5.gz /usr/share/man/man1/passwd.1.gz
[root@www1 ~]# whereis -s passwd
passwd:
[root@www1 ~]# whereis -b passwd
passwd: /usr/bin/passwd /etc/passwd


which、whereis、locate

标签:--   ram   font   director   option   pass   ash   als   完整路径   

原文地址:http://blog.51cto.com/12107790/2150921

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!