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

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

【语法】

whereis options argument

【常用选项】

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

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

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

【实例2】查找manual手册页

[root@perthon50 tmp]# whereis -m passwdpasswd: /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz[root@perthon50 tmp]# whereis -m cdcd: /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz[root@perthon50 tmp]# whereis -m sortsort: /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 passwdpasswd               (1)  - update user's authentication tokenspasswd               (5)  - password filepasswd [sslpasswd]   (1ssl)  - compute password hashes[root@perthon50 tmp]# whatis sortsort                 (1p)  - sort, merge, or sequence check text filessort                 (1)  - sort lines of text filessort                 (3pm)  - perl pragma to control sort() behaviour

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

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

【语法】

which COMMAND

【实例】

[root@perthon50 tmp]# which lsalias 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