Atime mtime CTime Find the most recently modified file

Source: Internet
Author: User

Teammates are to sell, in order to be sold, study hard. Sell teammates in the future!!!!! How to find configuration files that have been modified for nearly 30 minutes:
Find/–name ' *.conf '-mmin #查找最近30分钟修改过的文件find/-name ' *.conf '-mtime 0 #查找最近24小时修改过的文件
How to view the Atime,mtime,ctime of a file:

Before we go any further, I-d like-to remind-the-using stat command is probably the easiest-like Ree timestamps associated with each file:

ubuntu$ Stat./try File: './try ' size:0 blocks:0 IO block:4096 Regular Empty filedevice:801 h/2049d inode:655596 links:1access: (0644/-rw-r--r--) Uid: (1000/greys) Gid: (113/admin) access:20 08-11-17 05:01:16.000000000-0600modify:2008-11-17 05:01:16.000000000-0600change:2008-11-17 05:01:16.000000000- 0600

Even though LS command can used to view the same times, we'll depend on the stat command for today's post simply Beca Use it shows all the Times Together–it's great for explanations.

modifying Atime and Mtime

There ' s a very simple-to-update either Atime or Mtime for a given file, or even-both at the same time:you should use The Touch command.

Here's how it can be used to update the atime:

ubuntu$ touch-at 0711171533./try

The -A in the command line parameters refers to Atime, while- T and the following sequence is nothing b UT a timestamp we want assigned to the file.

In my example, 0711171533 means this:

    • 07–year of 2007

    • 11–november

    • 17–17th

    • 1533–time of the day, 15:33

Now, if we run stat command again, you can see how the Access Time field got updated:

 ubuntu$ stat ./try  file:  './try '   Size: 0                Blocks: 0           IO Block: 4096   regular empty  filedevice: 801h/2049d      inode: 655596       Links: 1Access:  (0644/-rw-r--r--)   Uid:  ( 1000/    Greys)    Gid:  (  113/   admin) access: 2007-11-17  15:33:00.000000000 -0600modify: 2008-11-17 05:01:16.000000000 -0600change: 2008-11-17  05:01:48.000000000 -0600 

similarly,  We can set the mtime, in my particular example it's the Future–a day exactly one year from now. -m is the command line option to specify this mtime is our main focus:

ubuntu$ touch-mt 0911171533./tryubuntu$ Stat./try File: './try ' size:0 blocks:0 IO block:40    Regular empty filedevice:801h/2049d inode:655596 links:1access: (0644/-rw-r--r--) Uid: (1000/greys) Gid: (113/admin) access:2007-11-17 15:33:00.000000000-0600modify:2009-11-17 15:33:00.000000000-0600change:2008 -11-17 05:05:41.000000000-0600
Changing Atime and Mtime to the current Unix time

It's probably useful to know that the default behavior of the Touch command was to update both access time and modification Time of a file, changing them to the current time on your system.

Here's what'll happen if I run touch against the same file we used in all the examples:

ubuntu$ Touch/tryubuntu$ Stat./try File: './try ' size:0 blocks:0 IO block:4096 regular em    Pty filedevice:801h/2049d inode:655596 links:1access: (0644/-rw-r--r--) Uid: (1000/greys) Gid: (113/ Admin) access:2008-11-17 05:09:33.000000000-0600modify:2008-11-17 05:09:33.000000000-0600change:2008-11-17 05:09:3 3.000000000-0600

As can see, all three fields has been reset to the new (current time) value.

This article is from the creator think blog, so be sure to keep this source http://strongit.blog.51cto.com/10020534/1737743

Atime mtime CTime Find the most recently modified file

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.