Use the touch command to change atime, Mtime

Source: Internet
Author: User
Tags touch command

Use the touch command alone to update the file's Atime, CTime, mtime for the moment

[Email protected] ~]# Stat profile
File: "Profile"
size:1796 blocks:8 IO block:4096 Normal file
device:803h/2051d inode:528818 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2015-04-12 5:44:56.145265376 +0800
modify:2015-04-12 5:44:56.145265376 +0800
change:2015-04-12 5:44:56.145265376 +0800

[[Email protected] ~]# Date
January 19, 2016 Tuesday 20:26:30 CST



[[email protected] ~]# Touch profile
[Email protected] ~]# Stat profile
File: "Profile"
size:1796 blocks:8 IO block:4096 Normal file
device:803h/2051d inode:528818 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2016-01-19 20:26:38.938555693 +0800
modify:2016-01-19 20:26:38.938555693 +0800
change:2016-01-19 20:26:38.938555693 +0800


Use the command "touch-a-t [YY]MMDDHHMM[.SS] filename" To change the file's Atime

[Email protected] ~]# touch-a-T 06062222 profile
[Email protected] ~]# Stat profile
File: "Profile"
size:1796 blocks:8 IO block:4096 Normal file
device:803h/2051d inode:528818 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2016-06-06 22:22:00.000000000 +0800
modify:2016-01-19 20:26:38.938555693 +0800
change:2016-01-19 20:30:57.160299376 +0800

Use the command "touch-m-t [YY]MMDDHHMM[.SS] filename" To change the file's Mtime

[[email protected] ~]# touch-m-T 2302030933.33 profile
[[email protected] ~]# stat-profile
  F Ile: "Profile"
  size:1796          Blocks:8           IO block:4096   Normal file
device:803h/2051d    inode: 528818      links:1
Access: (0644/-rw-r--r--)   Uid: (    0/     root)    Gid: (    0/    root)
access:2016-06-06 22:22:00.000000000 +0800
modify:2023-02-03 09:33:33.000000000 +0800
change:2016-01-19 20:34:38.521678423 + 0800

using the command "touch-c-t [YY]MMDDHHMM[.SS] filename", you can change the atime and mtime of a file
[[email protected] ~]# touch-c-T 1111111111.11 profile
[[email protected] ~]# stat-profile
  File: "Profile"
  size:1796          Blocks:8           IO block:4096   Normal file
device:803h/2051d     inode:528818      links:1
Access: (0644/-rw-r--r--)   Uid: (    0/     root)    Gid: (    0/    root)
Access:2011-11-11 11:11:11.000000000 +0800
modify:2011-11-11 11:11:11.000000000 +0800
change:2016-01-19 20:35:59.579968164 + 0800

Touch Command cannot modify CTime for a specified time

This article from "Good Freshman only gourd" blog, please be sure to keep this source http://zhuxingye.blog.51cto.com/11121336/1736606

Use the touch command to change atime, Mtime

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.