Linux timestamp management ——— Touch command

Source: Internet
Author: User
Tags touch command

Touch create file or update file timestamp
Format: Touch parameter file name

Parameters:

-C: Do not create a file that does not exist

-M: Update only modified time, not update access time

-A: Update access time only, not update modification time

-R file: Time to update files using file files

-T: Modifies the time to the date specified by the parameter, such as 01091135 for January 9 11:35


Additional Knowledge: View file information (created date): Ls-l View file information (access date): Ls-lu

[[email protected] 123]# tree                       //confessed to the experimental environment, which has the following folders and files .├── 1234│    └── 12345├── 1.txt├── 2├── 2.txt└── 3.txt2 directories, 4  files[[email protected] 123]# touch -c a.txt           //If there is a.txt, update its timestamp, and if not, do not create [[email protected] 123]# ls1234   1.txt  2  2.txt  3.txt[[email protected] 123]# ls -l 1. Txt-rw-r--r--.  1 root root 9 May  4 15:04 1.txt[[email  Protected] 123]# touch -c 1.txt[[email protected] 123]# ls -l 1. Txt-rw-r--r--.  1 root root 9 May  4 16:21 1.txt[[email  protected] 123]#  Ls -lu 1.txt-rw-r--r--.  1 root root 9 may  4 16:21 1. Txt[[email protected] 123]# touch -a 1.txt[[email protected] 123]# ls  -lu 1.txt-rw-r--r--.  1 root root 9 may  4 16:23 1.txt[ [Email protected] 123]# ls -l 2.txt-rw-r--r--.  1 root root 9  apr  5 05:17 2.txt[[email protected] 123]# touch -r 2.txt  1.txt[[email protected] 123]# ls -l 2.txt-rw-r--r--.  1 root root  9 Apr  5 05:17 2.txt[[email protected] 123]# touch -t  03301259 1.txt[[email protected] 123]# ls -l 1.txt-rw-r--r--.  1 root  root 9 mar 30 12:59 1.txt[[email protected] 123]#


This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://xuxiaoliang.blog.51cto.com/10882951/1922271

Linux timestamp management ——— Touch 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.