码迷,mamicode.com
首页 > 系统相关 > 详细

linux命令(9)---whereis、whatis、which命令

时间:2016-04-22 01:26:25      阅读:1540      评论:0      收藏:0      [点我收藏+]

标签:whereis   which   whatis   

whereis命令:locate the binary, source, and manual page files for a command

【功能】查找文件、手册页、命令等的相关位置,

【语法】

whereis options argument

【常用选项】

-b:只查找二进制文件位置
-m:只查找手册页部分

【实例1】查找二进制文件所在位置

[root@perthon50 tmp]# whereis -b passwd
passwd: /usr/bin/passwd /etc/passwd
[root@perthon50 tmp]# whereis -b shadow
shadow: /etc/shadow /usr/include/shadow.h

【实例2】查找manual手册页

[root@perthon50 tmp]# whereis -m passwd
passwd: /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
[root@perthon50 tmp]# whereis -m cd
cd: /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz
[root@perthon50 tmp]# whereis -m sort
sort: /usr/share/man/man1/sort.1.gz /usr/share/man/man3/sort.3pm.gz /usr/share/man/man1p/sort.1p.gz


whatis命令:search the whatis database for complete words

【功能】在whatis库中搜寻特定的命令

【语法】

whatis COMMAND

【实例】

[root@perthon50 tmp]# whatis passwd
passwd               (1)  - update user‘s authentication tokens
passwd               (5)  - password file
passwd [sslpasswd]   (1ssl)  - compute password hashes
[root@perthon50 tmp]# whatis sort
sort                 (1p)  - sort, merge, or sequence check text files
sort                 (1)  - sort lines of text files
sort                 (3pm)  - perl pragma to control sort() behaviour


which命令:shows the full path of (shell) commands

【功能】查看可执行命令的路径

【语法】

which COMMAND

【实例】

[root@perthon50 tmp]# which ls
alias ls=‘ls --color=auto‘
        /bin/ls
[root@perthon50 tmp]# which passwd
/usr/bin/passwd
[root@perthon50 tmp]# which cd
/usr/bin/which: no cd in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@perthon50 tmp]# which sort
/bin/sort
[root@perthon50 tmp]# which shutdown
/sbin/shutdown

本文出自 “perthon” 博客,请务必保留此出处http://perthon.blog.51cto.com/10484057/1766405

linux命令(9)---whereis、whatis、which命令

标签:whereis   which   whatis   

原文地址:http://perthon.blog.51cto.com/10484057/1766405

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