Linux Comm Touch
# Linux touch Command
[ Linux Command Manual](#)
The Linux touch command is used to modify the time attributes of a file or directory, including access time and modification time. If the file does not exist, the system will create a new file.
`ls -l` can display the time records of a file.
### Syntax
touch [file or directoryβ¦]
* **Parameter Description**:
* a Change the file's access time record.
* m Change the file's modification time record.
* c If the target file does not exist, do not create a new file. Same effect as --no-create.
* f Not used, retained for compatibility with other Unix systems.
* r Use the time record of a reference file, same effect as --file.
* d Set the time and date, can use various formats.
* t Set the file's time record, format is the same as the date command.
* --no-create Do not create a new file.
* --help List the command format.
* --version List version information.
### Example
Use the "touch" command to modify the time attributes of the file "testfile" to the current system time, enter the following command:
$ touch testfile #Modify the file's time attributes
First, use the ls command to view the attributes of testfile, as shown below:
$ ls -l testfile #View the file's time attributes #Original file modification time was 16:09 -rw-r--r-- 1 hdd hdd 55 2011-08-22 16:09 testfile
After executing the "touch" command to modify the file attributes, view the file's time attributes again, as shown below:
$ touch testfile #Modify file time attributes to current system time $ ls -l testfile #View the file's time attributes #Modified file time attributes are now current system time -rw-r--r-- 1 hdd hdd 55 2011-08-22 19:53 testfile
When using the "touch" command, if the specified file does not exist, it will create a new blank file. For example, in the current directory, use this command to create a blank file named "file", enter the following command:
$ touch file #Create a new blank file named "file"
[ Linux Command Manual](#)
YouTip