1. Computing
Send to a Friend via Email
Linux / Unix Command: touch
Command Library




touch [-acfm] [-r reference-file] [-t MMD-Dhhmm[[CC]YY][.ss]] [-d time]
[--time={atime,access,use,mtime,modify}] [--date=time]
[--file=reference-file] [--no-create] [--help] [--version]


Changes the date/time stamp of the file filename to the current time. Creates an empty file if the file does not exist. You can change the stamp to any date using

touch -t 200201311759.30 (year 2002 January day 31 time 17:59:30).

There are three date/time values associated with every file on an ext2 filesystem:

- the time of last access to the file (atime)
- the time of last modification to the file (mtime)
- the time of last change to the file's inode (ctime).

Touch will change the first two to the value specified, and the last one always to the current system time.


-a, --time=atime, --time=access, --time=use
Change the access time only.

-c, --no-create
Do not create files that do not exist.

-d, --date time
Use time (which can be in various common formats)
instead of the current time. It can contain month
names, timezones, `am' and `pm', etc.

-m, --time=mtime, --time=modify
Change the modification time only.

-r, --file reference-file
Use the times of reference-file instead of the cur-
rent time.

-t MMDDhhmm[[CC]YY][.ss]
Use the argument (months, days, hours, minutes,
optional century and years, optional seconds)
instead of the current time.

--help Print a usage message on standard output and exit

Print version information on standard output then
exit successfully.


% touch analysis_data.xls

Changes the timestamp of file analysis_data.xls to the current time.

Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux Command Library Index

>> Also see Shell Command Library

Discuss in my forum

©2014 About.com. All rights reserved.