Linux Touch Command

Source: Internet
Author: User
Tags touch command

The role of the Touch command is to create a new blank file and access (access) and modify (modify) timestamp for the file that is updated

View Help for Touch

Note: Modify changes to the contents of the file, regardless of whether access or modify changes, will result in changes in change time, because no matter which operation will cause the file's properties (change times) changes.

Mans Touch

How to use man:

Touch [OPTION] ... FILE ...

Options

-A change only the access time for the file to be modified

-C do not create a file, only modify the file timestamp

-D Modify the timestamp to the specified time

-M Modify File modification time

-R Modify access and modify (modify) timestamps as a reference to a file

-T STAMP modify the timestamp to the specified time

use [[CC]YY]MMDDHHMM[.SS] instead of the current time

Example

Touch update already has file time

First, use the Stat command to view the timestamp of the file

[Email protected]~]# stat test.txt

File: ' Test.txt '

size:0 blocks:0 IO block:4096 Regular empty file

device:803h/2051d inode:1399408 links:1

Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)

access:2017-03-31 16:57:32.000000000 +0800

modify:2017-03-31 16:57:32.000000000 +0800

change:2017-03-31 16:57:32.000000000 +0800

[Email protected] oldboy]# touch-a test.txt

[Email protected] oldboy]# stat test.txt

File: ' Test.txt '

size:0 blocks:0 IO block:4096 Regular empty file

device:803h/2051d inode:1399408 links:1

Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)

access:2017-03-31 17:00:14.000000000 +0800

modify:2017-03-31 16:57:32.000000000 +0800

change:2017-03-31 17:00:14.000000000 +0800










This article from the "Network connected to the World" blog, please be sure to keep this source http://3157957.blog.51cto.com/3147957/1912153

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