Touch (command)

File modification command on various operating systems

touch

Example of `touch` usage

Original author(s)| AT&T Bell Laboratories
Developer(s)| Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, Randy Smith, TSC, Microware, Apple, Digital Research, Novell, Kris Heidenstrom
Initial release| January 1979; 45 years ago (1979-01)
Written in| C
Operating system| Unix, Unix-like, Plan 9, Inferno, FLEX, OS-9, Classic Mac OS, Windows, DR DOS, AROS, FreeDOS, ReactOS, KolibriOS, IBM i
Platform| Cross-platform
Type| Command
License| coreutils: GPLv3+
FreeDOS: GPLv2
ReactOS: BSD-4-Clause
BusyBox: GPL-2.0-only
Toybox: 0BSD
Plan 9: MIT License

In computing, `touch` is a command used to update the access date and/or modification date of a computer file or directory. It is included in Unix and Unix-like operating systems, TSC's FLEX,[1] Digital Research/Novell DR DOS, the AROS shell,[2] the Microware OS-9 shell,[3] and ReactOS.[4] The command is also available for FreeDOS[5] and Microsoft Windows.[6]

## Overview[edit]

In its default usage, it is the equivalent of creating or opening a file and saving it without any change to the file contents. `touch` avoids opening, saving, and closing the file. Instead it simply updates the dates associated with the file or directory. An updated access or modification date can be important for a variety of other programs such as backup utilities or the make command-line interface programming utility. Typically these types of programs are only concerned with files which have been created or modified after the program was last run. The `touch` command can also be useful for quickly creating files for programs or scripts that require a file with a specific name to exist for successful operation of the program, but do not require the file to have any specific content.

The Single Unix Specification (SUS) specifies that `touch` should change the access times, modification times, or both, for a file. The file is identified by a pathname supplied as a single argument. It also specifies that if the file identified does not exist, the file is created and the access and modification times are set as specified. If no new timestamps are specified, `touch` uses the current time.

## History[edit]

A `touch` utility first appeared in Version 7 AT&T UNIX. Today, the command is available for a number of different operating systems, including many Unix and Unix-like systems, DOS, Microsoft Windows and the classic Mac OS.[which?]

The version of `touch` bundled in GNU coreutils was written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith.[7]

The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[8] The FreeDOS version was developed by Kris Heidenstrom and is licensed under the GPL.[9] DR DOS 6.0[10] and KolibriOS[11] include an implementation of the `touch` command. The touch command has also been ported to the IBM i operating system.[12]

## See also[edit]

* System time
* List of Unix commands

## References[edit]

1. ^ "FLEX 9.0 User's Manual" (PDF).
2. ^ "AROS Research Operating System". aros.sourceforge.io.
3. ^ Paul S. Dayan (1992). The OS-9 Guru - 1 : The Facts. Galactic Industrial Limited. ISBN 0-9519228-0-7.
4. ^ "reactos/reactos". GitHub.
5. ^ "ibiblio.org FreeDOS Group -- Utilities". www.ibiblio.org.
6. ^ "touch for Windows".
7. ^ "touch(1): change file timestamps - Linux man page". linux.die.net.
8. ^ "Native Win32 ports of some GNU utilities". unxutils.sourceforge.net.
9. ^ "ibiblio.org FreeDOS Package -- touch (Unix-like)". www.ibiblio.org.
10. ^ DR DOS 6.0 User Guide Optimisation and Configuration Tips
11. ^ "Shell - KolibriOS wiki". wiki.kolibrios.org.
12. ^ IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 5 September 2020.

## Further reading[edit]

* McElhearn, Kirk (2006). The Mac OS X Command Line: Unix Under the Hood. John Wiley & Sons. ISBN 978-0470113851.

## External links[edit]

The Wikibook Guide to Unix has a page on the topic of: Commands

* `touch` – Shell and Utilities Reference, The Single UNIX Specification, Version 4 from The Open Group
* `touch(1)` – Linux User Commands Manual
* `touch(1)` – Plan 9 Programmer's Manual, Volume 1
* `touch(1)` – Inferno General commands Manual
* examples showing how to use touch

* v
* t
* e

Unix command-line interface programs and shell builtins

File system|

* cat
* chattr
* chmod
* chown
* chgrp
* cksum
* cmp
* cp
* dd
* du
* df
* file
* fuser
* ln
* ls
* mkdir
* mv
* pax
* pwd
* rm
* rmdir
* split
* tee
* touch
* type
* umask

Processes|

* at
* bg
* crontab
* fg
* kill
* nice
* ps
* time

User environment|

* env
* exit
* logname
* mesg
* talk
* tput
* uname
* who
* write

Text processing|

* awk
* basename
* comm
* csplit
* cut
* diff
* dirname
* ed
* ex
* fold
* head
* iconv
* join
* m4
* more
* nl
* paste
* patch
* printf
* read
* sed
* sort
* strings
* tail
* tr
* troff
* uniq
* vi
* wc
* xargs

Shell builtins|

* alias
* cd
* echo
* test
* unset
* wait

Searching|

* find
* grep

Documentation|

* man

Software development|

* ar
* ctags
* lex
* make
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* expr
* lp
* od
* sleep
* true and false

* Categories
* Standard Unix programs
* Unix SUS2008 utilities
* List

* v
* t
* e

Plan 9 command-line interface programs and shell builtins

File system|

* chmod
* chgrp
* cmp
* cp
* dd
* du
* file
* gzip
* ls
* mkdir
* pwd
* rm
* split
* tee
* touch

Processes|

* kill
* ps

User environment|

* passwd
* who

Text processing|

* awk
* basename
* comm
* diff
* ed
* eqn
* join
* sed
* sort
* spell
* strings
* tail
* tr
* troff
* uniq
* wc

Shell builtins|

* echo
* test

Networking|

* ip/ipconfig
* ip/ping
* netstat

Searching|

* grep

Software development|

* ar
* hoc
* lex
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* fortune
* sleep

* Category

* v
* t
* e

GNU Core Utilities command-line interface programs

File system|

* chcon
* chmod
* chown
* chgrp
* cksum
* cp
* dd
* df
* dir
* dircolors
* install
* ln
* ls
* mkdir
* mkfifo
* mknod
* mktemp
* mv
* realpath
* rm
* rmdir
* shred
* sync
* touch
* truncate
* vdir

Text utilities|

* b2sum
* base32
* base64
* cat
* cksum
* comm
* csplit
* cut
* expand
* fmt
* fold
* head
* join
* md5sum
* nl
* numfmt
* od
* paste
* ptx
* pr
* sha1sum
* shuf
* sort
* split
* sum
* tac
* tail
* tr
* tsort
* unexpand
* uniq
* wc

Shell utilities|

* arch
* basename
* chroot
* date
* dirname
* du
* echo
* env
* expr
* factor
* false
* groups
* hostid
* id
* link
* logname
* nice
* nohup
* nproc
* pathchk
* pinky
* printenv
* printf
* pwd
* readlink
* runcon
* seq
* sleep
* stat
* stdbuf
* stty
* tee
* test
* timeout
* true
* tty
* uname
* unlink
* uptime
* users
* who
* whoami
* yes

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template