Home >Operation and Maintenance >Linux Operation and Maintenance >Linux command tutorial: Comparative search command whereis and which difference
This article mainly introduces relevant information about the difference between Linux command search commands whereis and which. Here are examples of how to distinguish their usage. Friends in need can refer to
Linux The difference between command search command whereis and which
一whereis
1. Syntax
##whereis Command name
-m: Only search for 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
1. Syntax
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
are defined System search command path
[root@localhost ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
The above is the detailed content of Linux command tutorial: Comparative search command whereis and which difference. For more information, please follow other related articles on the PHP Chinese website!