Linux Command Search command Whereis and which

Source: Internet
Author: User
Tags egrep

Linux Command Search command Whereis and which

In linux command Search command, may listen to a bit around the mouth, is the command of the search command.

First of all, Whereis, let's take a look at Whereis's manual.
Man Whereis man means the manual manual. The man command is to see how a command works and how to use it.

Mans Whereis

whereis-locate the Binary,source,and manual page files for a command
Locate the binary file for a command, the source file, and the Help manual.

Whereis [Options] Command

The options can include the following
-B Search for binaries. Search for executable files
-M search for manual. Search Manuals
-S search for source files
These three are common options, enough on the line.

If none of the options are added, it is the location of the search command and the Help manual for the command.

Example: Whereis ls
Output result ls:/bin/ls/usr/share/man/man1/ls.1.gz

Example: Whereis-b ls
Output result Ls:/bin/ls
Just check where the command is.

In the following: Whereis-m ls
Output result ls:/usr/share/man/man1/ls.1.gz
View the manual location of the command.

The which command is also a command to search for commands.
How it's used which command
Only the which command displays the location of the command and the alias of the command.
PS: Talk about the alias of the command. Execute the alias command in Linux.
Alias is the meaning of aliases.

will have the following output results
Alias egrep= ' Egrep--color=auto '
Alias fgrep= ' Fgrep--color=auto '
Alias grep= ' grep--color=auto '
Alias l= ' LS-CF '
Alias La= ' Ls-a '
Alias Ll= ' Ls-alf '
Alias ls= ' ls--color=auto '

Format is alias command= ' comand [options] '

Is that you execute the LS command in terminal, which is equivalent to executing the LS--color=auto command. The alias of the command can be modified on its own.
Format is alias command= ' comand [options] '
--color=auto make the result color of the command output adaptive (that is, the system default color)

Linux Command Search command Whereis and which

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.