Linux command Search the difference between whereis and which
- 2020-06-23 02:19:17
- OfStack
Linux command Search the difference between whereis and which
1 whereis
1, grammar,
whereis command name
Search the path of the command and the location of the help document
Options:
-ES23en: Find only executable files
-ES25en: Find the help file only
2, in 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
2 which
1, grammar,
which command name
Search the path and alias of the command
2, in 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
3 PATH environment variable
Defines the path to the system search command
[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
Above is the Linux command search command whereis and which the difference between the explanation, if you have any questions please leave a message or to this site community exchange discussion, we make progress together, thank you for reading, hope to help you, thank you for your support to this site!