Touch to modify the file timestamp, or create a new file that does not exist-copy

Source: Internet
Author: User

Linux of the Touch commands are not commonly used, generally in use Make may be used to modify the file timestamp, or to create a new file that does not exist. .

1 . command format:

Touch [ options] ... File ...

2 . Command parameters:

-A or--time=atime or--time=access or--time=use only change the access time.

- C or--no-create do not create any documents.

- D use the specified date time instead of the current time.

- F This parameter ignores non-processing and is responsible only for compatibility issues with BSD version touch directives.

- M or--time=mtime or--time=modify only change the change time.

- R sets the datetime of the specified document or directory to the same date and time as the reference document or directory.

- T use the specified date time instead of the current time.

3 . Command function:

Touch the command parameter can change the date time of the document or directory, including access time and change time.  

4 . Examples of use:

Instance one: Create a file that does not exist

Command:

[[email protected] wxj]# Touch 123.txt

Output:

[Email protected]]# ll

Total Dosage 0

[[Email protected]]# Touch 123.txt

[Email protected]]# ll

Total Dosage 0

-rw-r--r--1 root root 0 3 Month 8 01:19123.txt

[[Email protected]]#

Example three: Setting the timestamp of a file

Command:

[Email protected] wxj]# touch-t 201212311111.11 123.txt

Output:

[Email protected]]# ll

Total Dosage 0

-rw-r--r--1 root root 0 Month 123.txt

[Email protected]]# touch-t 201212311111.11 123.txt

[Email protected]]# ll

Total Dosage 0

-rw-r--r--1 root root 0 Month 123.txt

[[Email protected]]#


This article from "Flat Light is true" blog, please be sure to keep this source http://wuxiujian.blog.51cto.com/10583235/1748950

Touch to modify the file timestamp, or create a new file that does not exist-copy

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.