TOUCH(1)

NAME
touch - update date last modified of a file

SYNOPSIS
touch [ -c ] [ -f ] [ -t ] [ -a ] [ -m ] [ mmddhhmm [ yy ] ] file ...

DESCRIPTION
Touch attempts to set the modified date of each file. If a file exists and a time is not specified, this is done by reading a character from the file and writing it back. If a file does not exist, an attempt will be made to create it unless the -c option is specified. If the file to be touched is of zero length, utimes() is called to update both the time last modified and the time last accessed (unless either the -a or -m options are used).
The -f option will attempt to force the touch in spite of read and write permissions on a file.
The -t option can be used to reset the date on an existing file (kept in for backwards compatability). The last modified time is changed to that given by the date parameter which should be in the same format as accepted by the date(1) command. If this option is given the file is not written - however it must still be writable unless the -f flag is given and it must be owned by the user (unless the user is the superuser.)
The -m option updates only the modification time. The -a option updates only the access time. The default action if neither of these two options are given is -am

EXIT STATUS
The exit status from touch is the number of files that could not be successfully modified (including the files that did not exist and were not created).

BUGS
Complete numeric filenames may cause confusion as touch may assume that this is a date argument. This is only a cause of concern if there are multiple filenames. eg.
The command:

touch 01010000

will create (or update the access and modification times of) a file called 01010000.
Whereas, the command:

touch 10100000 file1

will update file1 to have the access and modification times set to 1st January 00:00. If file1 doesn't exist then the access and modification times will be set to the current date and time.

The -t option only updates the modification time even if the -a option is also given.

SEE ALSO
utimes(2), date(1)