In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the whereis command in Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.
Linux whereis command
The whereis command can help users find binaries, source code, and help pages for a command. Here is the format:
Whereis [options] [- BMS directory... -f] name...
This is the explanation given on the man page of this command:
Whereis can find binaries, source files, and help files for specified commands. When the found file is displayed, the main path name is removed, and then the (single) tail extension (e. G. C) of the file is removed, which comes from the source code control s. The prefix will also be removed. Next, whereis will try to find the specific program in the standard Linux location, as well as in the path specified by $PATH and $MANPATH.
The following examples, in the form of Quan A, will give you an intuitive idea of how to use the whereis command.
Q1. How to use the whereis command to find the location of binaries?
Suppose you want to find, for example, whereis commands where you are. Here are your specific actions:
Whereis whereis
How to find location of binary file using whereis
It is important to note that the output of the * path is the result you want. Using the whereis command, the help page and the path to the source code are also displayed. (it will appear if it can be found, but not in this example.) so the second path you see in the output is the location of the help page file.
Q2. How do you specify to search only binaries, help pages, or source code when searching?
If you want to search only, say, binaries, you can use the command line option-b. For example:
Whereis-b cp
How to specifically search for binaries, manuals, or source code
Similarly, the-m and-s options correspond to the help page and the source code, respectively.
Q3. How do I restrict the location where the whereis command searches?
By default, whereis looks for files from the hard-coded path defined by the match. But if you want, you can use command-line options to restrict the search. For example, if you only want to look for binaries in / usr/bin, you can use the-B option to do so.
Whereis-B / usr/bin/-f cp
Note: multiple paths can be given in this way. Use the-f option to explicitly separate the list of directories from the file names to search.
Similarly, if you want to search only help files or source code, you can use the-M and-S options accordingly.
Q4. How do I view the search path for whereis?
There is also an option corresponding to this. Just add-l after whereis.
Whereis-l
This is part of the output of the example:
How to see paths that whereis uses for search
Q5. How do I find a command with an exception entry?
For a whereis command, a command is considered an exception if it has more than one item for each explicit request type. For example, commands that do not have available documents, or commands that are scattered around the document, can be counted as exception commands. When you use the-u option, whereis displays commands with abnormal entries.
For example, the following example shows that there are no commands for corresponding documents or multiple documents in the current directory.
Whereis-m-u * Thank you for reading this article carefully. I hope the article "how to use whereis commands in Linux" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.