Linux----Find command

Source: Internet
Author: User

Find Command

Find is a very powerful command, it is directly to find the hard disk. The Linux Find command provides quite a lot of search criteria and is powerful. Because find has powerful features, it has a lot of options, most of which are worth taking the time to look at. Even if the system contains a network file system (NFS), the Find command works equally well in the file system, and you only have the appropriate permissions. When running a very resource-intensive find command, many people tend to put it in the background because it can take a long time to traverse a large file system (this refers to a file system with more than 30G bytes).

I first created the file name of the test.c normal file, we use the instruction mkdir, and LS view has created test.c.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/56/wKioL1c-SLrC-eemAAATMYeLBA0252.png "title=" Picture 1.png "alt=" Wkiol1c-slrc-eemaaatmyelba0252.png "/>

Filename:

1) 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/56/wKioL1c-SLrQ1hOiAAAJ-kDe0VI518.png "title=" Picture 2.png "alt=" Wkiol1c-slrq1hoiaaaj-kde0vi518.png "/>

2 ) find. /-name ' test.c* ' find file names including test files 650) this.width=650; "Src=" Http://s3.51cto. Com/wyfs02/m02/80/58/wkiom1c-r87rkuqtaaaodtxgc2i195.png "title=" image 3.png "alt=" wkiom1c-r87rkuqtaaaodtxgc2i195.png "/>

Regular Expressions:

1) Find use "! "To negate the argument.

find./!-name ' *.c '-print look for files with file names that are not. C and print them out. (The actual rear-print can be not, the effect will be displayed on the screen)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/58/wKiom1c-R87B8gahAABCpAs_28M629.png "title=" Picture 4.png "alt=" Wkiom1c-r87b8gahaabcpas_28m629.png "/>

2. Search by file time

Linux There are three timestamps for each file in the file system:

(1) Access Time (-atime): The last time the user visited the file;

(2) Modification Time (-mtime): The time the file content was last modified.

(3) Change Time (-ctime): The time the file metadata (metadata, such as permissions or ownership) was last changed.

-atime ,-mtime,-ctime as the time parameter, the unit is day. You can use + to represent greater than,-represent less than (and the same as +,-based on file size lookups).

We're only here for-mtime example, and the other two timestamps are the same.

1) find./-mtime-5 find files that have been modified less than or equal to 5 days

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/56/wKioL1c-SLvRcrDTAABVs6h38vM404.png "title=" Picture 5.png "alt=" Wkiol1c-slvrcrdtaabvs6h38vm404.png "/>

2) Find/-newer test.c Find a new file than test.c

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/80/58/wKiom1c-SeqARLpeAAAfCW9zTwg842.png "title=" Picture 6.png "alt=" Wkiom1c-seqarlpeaaafcw9ztwg842.png "/>

This article from the "Homeopathic and for" blog, reproduced please contact the author!

Linux----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.