Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
touch (command)
Standard Unix program used to change a file's access and modification timestamps

touch is a shell command that sets the modification timestamp of an existing file to be current – which on a Unix-based file system includes special files such as directories. If the input path does not specify an existing file, then it creates a new, regular file at the path.

The Single Unix Specification (SUS) specifies that touch changes the access or modification timestamps, or both. The file is identified by file system path supplied as the sole argument. If the path does not specify a file, the command creates a file with access and modification timestamps as specified or by default to the current time.

By default (no options specified), touching a file is equivalent to creating it with no content or if it exists, opening and saving it without any content changes to update the modification timestamp to be current. This convenience functionality is useful for a variety of scenarios including build and backup. The tools used in such scenarios typically ignore files that are older than a certain point of time. For example make ignores a source code file that is older than the object file it is used to create.

The command is often used to create a new file, so that can subsequently open it in an editor or to create a file required by an operation that does not require specific content.

A command first appeared in Version 7 AT&T UNIX. Today, the command is available for many operating systems, including many Unix and Unix-like systems, Windows (via UnxUtils and Touch for Windows.), classic Mac OS, DOS, FreeDOS, DR DOS 6.0, KolibriOS, FLEX, AROS, OS-9, ReactOS, and IBM i. The version bundled in GNU Core Utilities was written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith.

We don't have any images related to touch (command) yet.
We don't have any YouTube videos related to touch (command) yet.
We don't have any PDF documents related to touch (command) yet.
We don't have any Books related to touch (command) yet.
We don't have any archived web articles related to touch (command) yet.

See also

Further reading

  • McElhearn, Kirk (2006). The Mac OS X Command Line: Unix Under the Hood. John Wiley & Sons. ISBN 978-0470113851.
The Wikibook Guide to Unix has a page on the topic of: Commands

References

  1. "Native Win32 ports of some GNU utilities". unxutils.sourceforge.net. http://unxutils.sourceforge.net/

  2. "touch for Windows". https://sourceforge.net/projects/touchforwindows/

  3. "ibiblio.org FreeDOS Package -- touch (Unix-like)". www.ibiblio.org. http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/touch.html

  4. "ibiblio.org FreeDOS Group -- Utilities". www.ibiblio.org. http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-util.html

  5. DR DOS 6.0 User Guide Optimisation and Configuration Tips https://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf

  6. "Shell - KolibriOS wiki". wiki.kolibrios.org. http://wiki.kolibrios.org/wiki/Shell

  7. "FLEX 9.0 User's Manual" (PDF). http://www.flexusergroup.com/flexusergroup/pdfs/swflexum.pdf

  8. "AROS Research Operating System". aros.sourceforge.io. https://aros.sourceforge.io/documentation/users/shell/index.php

  9. Paul S. Dayan (1992). The OS-9 Guru - 1 : The Facts. Galactic Industrial Limited. ISBN 0-9519228-0-7. 0-9519228-0-7

  10. "reactos/reactos". GitHub. https://github.com/reactos/reactos

  11. IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 5 September 2020. /wiki/IBM

  12. "touch(1): change file timestamps - Linux man page". linux.die.net. https://linux.die.net/man/1/touch