Linux essay (TEN)---find command

Source: Internet
Author: User

first, the purposeThis article describes the various search commands that are commonly used in Linux environments. These find commands include which, Whereis, find, locate.
Which use environment variables to find the path to the executable file, Whereis find the executable file, source code, the path of the man file, the Find command can find any file in the file system, support regular expression lookup, locate command to find the file through the previously established index, So faster than find, but not suitable for finding recently created or renamed files.
This article will select the ubuntu14.04 release as the basis for the description.

second, which commandThe which is found in the path variable of the current user and ultimately displays the full path of the executable.
Note: The file type that which looks for is an executable file, not all files can be found.
Syntax: which command
For example, use the which LS command to find the full path to the LS executable file.


iii. Whereis OrderThe whereis command indicates the path to the executable file, source code, and man file for the given file.
Syntax: Whereis filename
For example, use the Whereis ls command to find the full path to the LS file's executable file, source code, and man file.


iv. Find CommandThe Find command is the most powerful file finder in a Linux system, and the Find command finds files based on a user-specified starting lookup path and uses regular expressions for fuzzy matching.
Syntax: Find path expression
Path: The user-specified start lookup path.
Expression: Regular expression.
For example, use the Find command to find the full path to all files associated with the LS file.


v. Locate CommandThe locate command finds files through the previously established index file, so the locate command looks faster than find, but is limited to the index file, so you cannot find recently created or renamed files.
Syntax: Locate patterns
For example, use locate to find the full path of all files that match the LS pattern.


Vi. SummaryThe most common tools for locating files under Linux are which and Find,which, which, through the environment variable path, confirm the path of executable commands executed under the shell, and find searches all types of files based on regular expressions and is more general.

Copyright Notice:original works, such as non-commercial reprint, please specify the source, such as commercial reprint publication, please contact the author.

Linux essay (TEN)---find command

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.