Linux Search related directives

Source: Internet
Author: User

    1. File file path: View the file type, as well as special permissions, and some other information. Common types include,ASCII text(plain text),executable(executable file),data (file), and so on.

    2. which [-a] command: To search for the absolute path of the file corresponding to the path of the environment variable path . Parameter -A, which lists all the instructions that can be found in the PATH directory, not just the first one that was found. In addition the CD This instruction is built-in instructions, so the command cannot be searched.

    3. Whereis [-bmsi]: File or directory name, parameters:

1)-B: only binary format files are found.

2)-M: Only find files under Manul path

3)-S: only source files are found

4)-u: Search for other special files that are not in the above three items

5) all files are searched by default.

Linux all files are recorded in a database file, and when you use the Whereis or a Locate , the content of this database file will prevail, therefore, the use of the directive is likely to find the deleted files or can not find the newly created file situation.

4.locate [-ir] Keyword: the path of the fuzzy retrieval file. Parameters

1)-I: Ignore case

2)-R: followed by regular expression.

The data found by locate is searched for by the data inside the established database/var/lib/mlocate , so it is not necessary to access the data directly from the hard drive. This database is updated once a day. The user can use the UPDATEDB directive to update the database. updatedb will read /erc/updatedb.conf This configuration file settings, and then go to the hard drive to search the file name, and finally update the entire database.

5.find [PATH] [option][action]: Search for files by directly searching the hard disk. Parameters:

1) Time-related options: Total -atime,-ctime,-mtime, -mtime for example,

-mtime n:n is a number, which means a file that has been changed in the day before N days

-mtime–n: Column within n days (containing n days) changed file

-mtime +n: Lists files that have been changed before n days ( excluding n days themselves)

-newer file: List files that are newer than file

Other time parameters are similar. The plot of Time is as follows (take 3 days for example):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/0F/wKioL1SQWOmC0EkkAAA8Gz3TsfQ746.jpg "title=" m3x) 0~ {ik11ukwz_ys8gk%h.png "alt=" Wkiol1sqwomc0ekkaaa8gz3tsfq746.jpg "/>

2) -uid n: Uid of the user , this information is stored in the/etc/passwd

3) -gid N: group ID, this information is stored in the/etc/group

4) -user name:name for user name

5) -group name: User group name

6) -nouser: The person who finds the owner of thefile does not exist in /etc/passwd

7) -nogruop: A file witha group that does not exist under /etc/group

8) -name filename: Search by file name

    9)   -size [+ +] Size: Search than size big ( + c stands for Byte stands for 1024byte

-type type: Search for type of file , Reyou main there, general file (F), device file (b,c), directory (D ), link file (l),socket(s).

Perm mode: Search file permissions just equal to the mode of the file,mode is a number representation of the rights such as 777.

-perm–mode: Search must be a file that includes all of the mode permissions.

-perm +mode: Search for files with permissions to any mode

-exec command:exec can then pick up additional instructions to process the search results.

-print: Print the results to the screen, this action is preset.


This article is from "Tiger Brother's Blog" blog, please be sure to keep this source http://7613577.blog.51cto.com/7603577/1590857

Linux Search related directives

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.