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)