touch Command in Linux

Back

The simplest way to create new files is with the touch command. The file created by touch is and empty or null file.

For example

The touch abc command creates an empty file named abc in the local directory. The touch command is also used to change the last access date of a file.


$ touch [-a] [-c] [-m] [-r ref_file | -t time ] file .

-a             Change the access time of file. Do not change the modification time unless -m is also specified.

-c             Do not create a specified file if it does not exist. Do not write any diagnostic messages concerning this condition.

-m             Change the modification time of file. Do not change the access time unless -a is also specified.

-r ref_file   Use the corresponding times of the file named by ref_file instead of the current time.

-t time     Use the specified time instead of the current time. time will be a decimal number of the form .