Home > Operation and Maintenance > Linux Operation and Maintenance > Linux command tutorial: Comparative search command whereis and which difference

Linux command tutorial: Comparative search command whereis and which difference

巴扎黑
Release: 2017-09-08 10:46:30
Original
2067 people have browsed it

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

Search the path where the command is located and the location of the help document


Options:


-b: Search only Executable file

-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
Copy after login

二which


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
Copy after login


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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template