The touch
command is used to modify the time properties of a file or directory, including access time and modification time. If the file does not exist, the system will create a new file.
-a
: Change only the access time.-c, --no-create
: Do not create any files.-d, --date=STRING
: Parse STRING
and use it as the access and modification time.-f
: This option is ignored.-h, --no-dereference
: Affect each symbolic link instead of any referenced file, useful only on systems that can change the timestamp of symbolic links.-m
: Change only the modification time.-r, --reference=FILE
: Use the time of this file instead of the current time.-t STAMP
: Use [[CC]YY]MMDDhhmm[.ss]
instead of the current time.--time=WORD
: Change the specified time, where WORD
is access
, atime
, or use
, equivalent to -a
; and WORD
is Modify
or mtime
, equivalent to -m
.--help
: Display help information.--version
: Display version information.Create an empty file, if the file already exists, it will change the file's access time.
Create multiple files.
Create files with a template file name.
Change the access time of a file and view the file attributes.
Change the modification time of a file and view the file attributes.
Change both the access time and modification time and set a specific access and modification time.