The touch command changes certain dates for each file argument. By default, touch sets both the date of last file modification and the date of last file access to the current time. This is useful for maintaining correct release times for software and is particularly useful in conjunction with the MKS Make software development facility.
sets only the access time.
does not create any files that do not already exist. Normally, touch creates such files.
sets only the modification time.
If you do not specify
To tell touch to use a time other than the current, use one of the following options:
is an obsolete version of the POSIX-compliant
sets the access and modification times (as indicated by the other options) to those kept for agefile.
specifies a particular time using this format:
where cc is the optional first 2 digits of the year, yy is the optional last 2 digits of the year, MM is the optional number of the month (01-12), dd is the optional day of the month, hh is the hour in 24 hour format (required), mm is the minutes (required), ss is the optional seconds.
An obsolete (but still supported) version of this command lets you omit
sets the modification time of newfile to the present.
touch -t 8001031305 oldfile
sets the modification time of oldfile to 13:05 on January 3, 1980.
touch -r oldfile newfile
sets the modification time of newfile to that of oldfile.
Possible exit status values are:
Failure due to any of the following:
Failure that resulted in a usage message, including:
- Age file inaccessible
indicates that time could not be found for the file given with the
-for -roption either because that file does not exist or because the requesting user is not granted the appropriate permission for the file.
- Missing age file argument
-for -r, but did not give a file name after it.
- Years earlier than year invalid
Your system only recognizes dates back to the given year. touch does not accept dates before that time.
- Bad date conversion
- Only one
-r( -f) or -tflag allowed
- Missing date/time argument
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.
touch is provided as both an external utility and a built-in MKS KornShell utility.
On the extended FAT file system, the earliest date accepted is 1980. On the NTFS file system, the earliest date accepted is 1970.
The touch utility does not accept dates and times past 11:59.59 pm on December 31, 2099.
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 9.6 patch 1 Documentation Build 5.