Home > System Tutorial > LINUX > Linux whereis command

Linux whereis command

PHPz
Release: 2024-02-15 13:10:02
forward
752 people have browsed it

The whereis command is specifically used to search for program names. It can search binary files (using the -b parameter), man description files (using the -m parameter) and source code files (using the -s parameter). Without any parameters, it returns all relevant information.

Linux whereis command

Compared with the find command, the search speed of the whereis command is very fast. This is because the Linux system records all file information in a database file. When we use whereis or the locate command to be introduced next, it will find the data directly from the database instead of traversing the hard disk like the find command, so it is more efficient.

The message has been received. The following is the result of deep pseudo-originalization of the paragraph you provided: > The whereis command is specially used to search for program names. It can search for binary files (using the -b parameter) and man description files (using -m parameter) and source code files (using the -s parameter). Without any parameters, it returns all relevant information. > Compared with the find command, the search speed of the whereis command is very fast. This is because the Linux system records all file information in a database file. When we use whereis or the locate command to be introduced next, it will find the data directly from the database instead of traversing the hard disk like the find command, so it is more efficient.

However, the database file is not updated in real time. By default, it is updated once a week. Therefore, when we use whereis and locate to search for files, we sometimes find data that has been deleted, or the file has just been created but cannot be found. The reason is that the database file has not been updated.

Command format

whereis [参数]... 文件名
Copy after login

Command function

The

whereis command is to locate the location of executable files, source code files, and help files in the file system. The attributes of these files should belong to original code, binary files, or help files. The whereis program also has the ability to search source code, specify alternative search paths, and search for unusual items.

命令参数

  • -b 定位可执行文件。
  • -m 定位帮助文件。
  • -s 定位源代码文件。
  • -u 搜索默认路径下除可执行文件、源代码文件、帮助文件以外的其它文件。
  • -B 指定搜索可执行文件的路径。
  • -M 指定搜索帮助文件的路径。
  • -S 指定搜索源代码文件的路径。

找出ls命令位置和帮助文档的位置

> whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
Copy after login

显示ls命令的二进制程序

> whereis -b ls
ls: /usr/bin/ls
Copy after login

显示ls命令的帮助文档

> whereis -m ls
Copy after login

The above is the detailed content of Linux whereis command. For more information, please follow other related articles on the PHP Chinese website!

source:lxlinux.net
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