Exploration of the Find command under Linux

Source: Internet
Author: User
Tags echo command

In the Linux graphical interface, we can easily view a file or directory to see the last modified time and access time.

Unfortunately, on Linux or Unix-like operating systems, the creation date of the file was not saved for us.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/80/65/wKiom1c_zI3RnlwyAAC2PA1R-mw637.png "title=" View file information "alt=" Wkiom1c_zi3rnlwyaac2pa1r-mw637.png "/>

But the fundamental, graphical operation will be converted to the corresponding command to execute.

Under the Linux terminal, how do we view the information of a file or directory through a shell command?

Here we use the Find command, here is the use and description of the Find command:


usage: find. {-atime/-ctime/-mtime/-amin/-cmin/-mmin} [-/+]num

Parametric analysis:

1. The first parameter ".", which represents the current directory, if it is a different directory, you can enter the absolute directory and relative directory location;

2. The second parameter is divided into two parts, the preceding letter A, C, M is the operation type, the following time is the date, Min is the minute (note only time, Min as the unit);

3. The third parameter is the amount, in which the unsigned representation conforms to that number , with the band-indicating that the number of the following is met, with a + to indicate compliance with the number of previous .

Parameter description:

Atime: Access time, refers to the time at which the file was last read, and the Access command regrets updating to the current time;

CTime: Change time, refers to the last time the file itself was changed, the change action can make chmod, CHGRP, MV and so on;

Mtime: Modified time (Modify times), refers to the file content is modified at the last time, modify the action can make echo redirect, vi and so on;


Take file as an example:

Before any action is done:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/65/wKiom1c_10OCm54QAAAvsVg-uB8552.png "title=" 1.png " Style= "Float:none;" alt= "Wkiom1c_10ocm54qaaavsvg-ub8552.png"/>


After access using the Cat command:


650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/65/wKiom1c_10OSlnL0AAA8_opTsFo025.png "style=" float: none; "title=" 2.png "alt=" Wkiom1c_10oslnl0aaa8_optsfo025.png "/>



650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/63/wKioL1c_2DKzjbQ-AAA8_opTsFo710.png "style=" float: none; "title=" 5.png "alt=" Wkiol1c_2dkzjbq-aaa8_optsfo710.png "/>


When modified with the echo command:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/63/wKioL1c_2DKBUaK2AAA9g6kW6gs264.png "title=" 6.png " Style= "Float:none;" alt= "Wkiol1c_2dkbuak2aaa9g6kw6gs264.png"/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/63/wKioL1c_2DKAd5kRAAAvsVg-uB8975.png "title=" 4.png " Style= "Float:none;" alt= "Wkiol1c_2dkad5kraaavsvg-ub8975.png"/>


Examples of find-atime use:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/65/wKiom1c_10PA625mAABP3ZWG7jk325.png "title=" 3.png " Style= "Float:none;" alt= "Wkiom1c_10pa625maabp3zwg7jk325.png"/>


Find-ctime Use example: 650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M00/80/63/wKioL1c_ 2zrdn6scaaa0ur8gvos666.png "title=" 112312312320160521113959.png "alt=" Wkiol1c_2zrdn6scaaa0ur8gvos666.png "/>





Exploration of the Find command under Linux

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.