a whereis
1. Grammar
whereis command name
The path where the search command is located and where the help documentation is located
Options:
-b: look for executable files only
-m: find only help files
2. Actual combat
[root@localhost ~]# whereis ls
ls:/usr/bin/ls /usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz
[root@localhost ~]# whoami
root
[root@localhost ~]# whatis
whatis what?
[root@localhost ~]# whatis ls
ls (1)- list directory contents
ls (1p)- list directory contents
[root@localhost ~]# whereis -b ls
ls:/usr/bin/ls
[root@localhost ~]# whereis -m ls
ls:/usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz
二 which
1. Grammar
which command name
Search command path and alias
2. Actual combat
[root@localhost ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
[root@localhost ~]# which pwd
/usr/bin/pwd
[root@localhost ~]# whereis cd
cd:/usr/bin/cd /usr/share/man/man1/cd.1.gz/usr/share/man/man1p/cd.1p.gz
[root@localhost ~]# which cd
/usr/bin/cd
Three PATH environment variables
Defines the path of the system search command
[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin