The Touch command in Linux uses (creates a file)

Source: Internet
Author: User
Tags set time touch command

The Touch command has two features:

1. To update the time label of existing files to the current time of the system (default), their data will remain intact;

2. Used to create a new empty file.

Grammar
Touch (options) (parameters)
Options
-A: or--time=atime or--time=access or--time= use  only changes the access time;-C: or--no-create  does not create any files;-d:< Time Date > use the specified datetime instead of the current time;-f: This parameter ignores non-processing and is only responsible for compatibility issues with BSD version touch directives;-M: or--time=mtime or--time=  Modify  only the time of change;-r:< reference file or directory > the   date time of the specified file or directory is set to the same date and time as the reference file or directory;-t:< date Time >   use the specified date time, not the current time;--help: Online assistance;--version: Displays version information.
Parameters
File: Specifies the list of files for which you want to set time properties.
Examples are as follows

1. Create a file that does not exist

Touch A.txt

If you want to create multiple empty files in a row, you can separate them with spaces, such as: Touch a.txt b.txt c.txt d.log

Similarly, you can create a file with an absolute path

Touch-c F.txt If F.txt does not exist, the file is not created and if present the update file time is the current time

2. Update F.txt with the same timestamp as A.txt

Touch-r a.txt F.txt

3. Set the timestamp of the file

Touch-t 201801142234.50 A.txt

The Touch command in Linux uses (creates a file)

Related Article

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.