Linux whereis command and find command are a bit similar, whereis command finds faster, but can only find the program name, the following with the small series to understand the specific use of the whereis command Let's go.
whereis command searches only binary files (parameter -b), man documentation (parameter -m) and source code files (parameter -s). If the parameter is omitted, all information is returned.
Compared with find, whereis lookup is very fast, this is because the Linux system will record all the files in the system in a database file, when using whereis and the locate below will be Finding data from the database, rather than looking through the hard disk, like the find command, is naturally very efficient.
But the database file is not updated in real time. It is updated once a week by default. Therefore, when we use whereis and locate to find files, we sometimes find data that has been deleted, or just created a file. I can't find it because the database file has not been updated.
1. Command format:
whereis [-bmsu] [BMS directory name -f ] File name
2. Command Function:
The whereis command locates the executable file, source code file, and help file in the file system. The attributes of these files should belong to the original code, binary file, or help file. The whereis program also has the ability to search for source code, specify alternate search paths, and search for unusual items.
3. Command parameters:
-b Locate the executable file.
-m Locate the help file.
-s Position the source code file.
-u Searches for files other than executable files, source code files, and help files in the default path.
-B Specifies the path to search for executable files.
-M Specifies the path to search for help files.
-S Specifies the path to search for source code files.
4. Example:
Instance 1: Find the files related to the ** file
Command:
whereis svn
Output:
[root@localhost ~]# whereis tomcat
tomcat:
[root@localhost ~]# whereis svn
svn: /usr/bin/svn /Usr/local/svn /usr/share/man/man1/svn.1.gz
Description:
tomcat is not installed, can not find out, svn installation found a lot of related documents < Br>
Instance 2: Find only binary files
Command:
whereis -b svn
Output:
[root@localhost ~]# whereis -b svn
svn: /usr/bin/svn /usr/local/svn
[root@localhost ~]# whereis -m svn
Svn: /usr/share/man/man1/svn.1.gz
[root@localhost ~]# whereis -s svn
svn:
[root@ Localhost ~]#
Description:
whereis -m svn Isolated documentation path, whereis -s svn Source source file.
The above is the usage of the whereis command under Linux. The conditions of the whereis command search are relatively limited. If you only search for the program name, using the whereis command is very fast.
Linux needs to use Python, you need to configure its environment, because there are more steps invol
The scp command is a file transfer command in Linux. Its usage details the system home Linux scp com
A lot of people compile Linux Kernel, the version number in the generated RPM packa
To avoid wasting extra space on the system, it is necessary to extend the XFS file system. How do yo
How to solve the problem that Ubuntu system can't mount U disk?
Linux to view Oracle related process methods through ps command
How to brush the original Debian system in the set-top box
FreeBSD steps to load iso files through virtual CD-ROMs
Steps to install GitLab on CentOS system
What should I do when the Ubuntu hard disk reads and writes?
Linux system iptables error iptables: Protocol wrong how to do?
Do you know the 7 major trends in the Linux desktop space?
Linux off screen splash screen method
Linux yum prompt ERROR: how to solve the dbus error?
How to add HyperTerminal to Windows 7
Win7 system printing common problem solution
How to close the new notification of Win10 Hide the new notification icon method of Win10 taskbar
Win10 technology preview application tips
When using yum, another application is applying yum lock; wait for it to exit
Through the registry to solve the Win7 system can not enter the safe mode failure method
Win10 UWP version of "Skype Preview" welcome update: software performance improvement