What is the difference between whereis and which in Linux
What is the difference between whereis and which in Linux? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Linux Command the difference between the search command whereis and which
One whereis
1. Grammar
Whereis command name
Search for the path where the command is located and the location of the help document
Options:
-b: find only executable files
-m: find only help files
2. Actual combat
[root@localhost ~] # whereis lsls:/usr/bin/ls / usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz [root@localhost ~] # whoamiroot [root@localhost ~] # whatiswhatis what? [root@localhost ~] # whatis lsls (1)-list directory contentsls (1p)-list directory contents [root@localhost ~] # whereis-b lsls:/usr/bin/ls [root@localhost ~] # whereis-m lsls:/usr/share/ Man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz
Two which
1. Grammar
Which command name
Search for the path and alias where the command is located
2. Actual combat
[root@localhost] # which lsalias ls='ls-- color=auto'/usr/bin/ls [root@localhost ~] # which pwd/usr/bin/pwd [root@localhost ~] # whereis cdcd:/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 to the system search command
[root@localhost] # echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin this is the answer to the question about what is the difference between whereis and which in Linux. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.