Detailed explanation of linux touch command:
1. Command function:
Time stamp for creating files and modifying files or directories
2. Command syntax:
touch [Option] [File name or directory name]
3. Command parameters:
-a Only modify the file Access time.
-c or --no-create Do not create files that do not exist.
-d uses the specified date and time instead of the current time
-m refers to modifying the Modify time without modifying it access (access) time
-r file Use the timestamp of the specified file file to update the timestamp of the file (access, modify)
Note: access indicates the time when the file was last accessed (only accessed, not changed)
modify indicates the time when the file was last modified
change indicates the time when the file attributes were last changed, including permissions, size, attributes, etc.
-t Modifies the time to the date specified by the parameter, such as: 07081556 represents July 8, 15:56
4. Usage example:
Create a file that does not exist, such as creating it in the /data directory:
Modify the access time of the file, such as modifying the access time of westoslinux in the above figure
Modify the modify time of the file, such as modifying / Modify time of data/westoslinux file
Use the specified time to change the access or modify time of the file or directory, for example, modify the access time of the file above to 2012-07-15 08:30:30, to modify the modify timestamp, just change the parameter a to m.
The above is the detailed content of Detailed explanation of linux touch command. For more information, please follow other related articles on the PHP Chinese website!