# Touch (command)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Touch_(command)
> Markdown URL: https://mediated.wiki/source/Touch_(command).md
> Source: https://en.wikipedia.org/wiki/Touch_(command)
> Source revision: 1336737619
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|File creation and timestamp updating shell command}}
{{lowercase}}
{{Infobox software
| name                   = touch
| logo                   = 
| screenshot             = Touch-example.png
| screenshot size        = 
| caption                = Example of <code>touch</code> usage
| author                 = [AT&T Bell Laboratories](/source/AT%26T_Bell_Laboratories)
| developer              = Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, Randy Smith, [TSC](/source/Technical_Systems_Consultants), [Microware](/source/Microware), [Apple](/source/Apple_Inc.), [Digital Research](/source/Digital_Research), [Novell](/source/Novell), Kris Heidenstrom
| released               = {{Start date and age|1979|1}}
| latest release version = 
| latest release date    = 
| programming language   = [C](/source/C_(programming_language))
| operating system       = [Unix](/source/Unix), [Unix-like](/source/Unix-like), [Plan 9](/source/Plan_9_from_Bell_Labs), [Inferno](/source/Inferno_(operating_system)), [FLEX](/source/FLEX_(operating_system)), [OS-9](/source/OS-9), [Classic Mac OS](/source/Classic_Mac_OS), [Windows](/source/Microsoft_Windows), [DR DOS](/source/DR_DOS), [AROS](/source/AROS_Research_Operating_System), [FreeDOS](/source/FreeDOS), [ReactOS](/source/ReactOS), [KolibriOS](/source/KolibriOS), [IBM i](/source/IBM_i)
| platform               = [Cross-platform](/source/Cross-platform)
| genre                  = [Command](/source/Command_(computing))
| license                = [coreutils](/source/coreutils): [GPLv3+](/source/GPLv3%2B)<br />FreeDOS: [GPLv2](/source/GPLv2)<br />ReactOS: [BSD-4-Clause](/source/BSD-4-Clause)<br />[BusyBox](/source/BusyBox): [GPL-2.0-only](/source/GNU_General_Public_License)<br />[Toybox](/source/Toybox): [0BSD](/source/BSD_licenses)<br />Plan 9: [MIT License](/source/MIT_License)
| website                = 
}}
'''<code>touch</code>''' is a [shell](/source/shell_(computing)) [command](/source/command_(computing)) that sets the modification timestamp of an existing [file](/source/computer_file) to be current {{endash}} which on a [Unix](/source/Unix)-based [file system](/source/file_system) includes [special files](/source/Unix_file_type) such as [directories](/source/directory_(computing)). If the input [path](/source/Path_(computing)) does not specify an existing file, then it creates a new, regular file at the path. 

The [Single UNIX Specification](/source/Single_UNIX_Specification) (SUS) specifies that <code>touch</code> 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](/source/software_build) and [backup](/source/backup). The tools used in such scenarios typically ignore files that are older than a certain point of time. For example, [make](/source/make_(software)) ignores a [source code](/source/source_code) file that is older than the [object file](/source/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](/source/Version_7_Unix) [AT&T UNIX](/source/AT%26T_UNIX). Today, the command is available for many [operating system](/source/operating_system)s, including many [Unix](/source/Unix) and [Unix-like](/source/Unix-like) systems, Windows (via [UnxUtils](/source/UnxUtils)<ref>{{Cite web|url=https://unxutils.sourceforge.net/|title=Native Win32 ports of some GNU utilities|website=unxutils.sourceforge.net|access-date=11 August 2025|archive-date=9 February 2006|archive-url=https://web.archive.org/web/20060209022842/http://unxutils.sourceforge.net/|url-status=live}}</ref> and Touch for Windows.<ref>{{Cite web|url=https://sourceforge.net/projects/touchforwindows/|title=touch for Windows}}</ref>), [classic Mac OS](/source/classic_Mac_OS), [DOS](/source/DOS), [FreeDOS](/source/FreeDOS),<ref>{{Cite web|url=http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/touch.html|title=ibiblio.org FreeDOS Package -- touch (Unix-like)|website=www.ibiblio.org|access-date=13 November 2018|archive-date=13 March 2019|archive-url=https://web.archive.org/web/20190313222905/http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/touch.html|url-status=live}}</ref><ref>{{Cite web|url=http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-util.html|title=ibiblio.org FreeDOS Group -- Utilities|website=www.ibiblio.org|access-date=13 November 2018|archive-date=30 September 2018|archive-url=https://web.archive.org/web/20180930110109/http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-util.html|url-status=live}}</ref> [DR DOS 6.0](/source/DR_DOS_6.0),<ref name="drdos6userguide">{{Cite web |url=https://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf |title=DR DOS 6.0 User Guide Optimisation and Configuration Tips |access-date=11 August 2019 |archive-date=30 September 2019 |archive-url=https://web.archive.org/web/20190930135943/http://www.4corn.co.uk/archive/ |url-status=live }}</ref> [KolibriOS](/source/KolibriOS),<ref>{{Cite web|url=http://wiki.kolibrios.org/wiki/Shell|title=Shell - KolibriOS wiki|website=wiki.kolibrios.org|access-date=11 August 2019|archive-date=11 February 2019|archive-url=https://web.archive.org/web/20190211231827/http://wiki.kolibrios.org/wiki/Shell|url-status=live}}</ref> [FLEX](/source/FLEX_(operating_system)),<ref>{{Cite web|url=http://www.flexusergroup.com/flexusergroup/pdfs/swflexum.pdf|title=FLEX 9.0 User's Manual|access-date=10 June 2019|archive-date=25 July 2021|archive-url=https://web.archive.org/web/20210725110201/http://www.flexusergroup.com/flexusergroup/pdfs/swflexum.pdf|url-status=live}}</ref> [AROS](/source/AROS_Research_Operating_System),<ref>{{Cite web|url=https://aros.sourceforge.io/documentation/users/shell/index.php|title=AROS Research Operating System|website=aros.sourceforge.io|access-date=12 September 2020|archive-date=2 July 2019|archive-url=https://web.archive.org/web/20190702203042/http://aros.sourceforge.net/documentation/users/shell/index.php|url-status=dead}}</ref> [OS-9](/source/OS-9),<ref>{{cite book|author=Paul S. Dayan|year=1992|title=The OS-9 Guru - 1 : The Facts|publisher=Galactic Industrial Limited|isbn=0-9519228-0-7}}</ref> [ReactOS](/source/ReactOS),<ref>{{Cite web|url=https://github.com/reactos/reactos|title=reactos/reactos|website=GitHub|access-date=29 July 2019|archive-date=11 December 2017|archive-url=https://web.archive.org/web/20171211170155/https://github.com/reactos/reactos|url-status=live}}</ref> and [IBM i](/source/IBM_i).<ref>{{cite web |title=IBM System i Version 7.2 Programming Qshell |language=en |author=IBM |website=[IBM](/source/IBM) |author-link=IBM |url=https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzahz/rzahzpdf.pdf?view=kc |access-date=2020-09-05 |archive-date=18 September 2020 |archive-url=https://web.archive.org/web/20200918130823/https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzahz/rzahzpdf.pdf?view=kc |url-status=live }}</ref> The version bundled in [GNU Core Utilities](/source/GNU_Core_Utilities) was written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith.<ref>{{Cite web|url=https://linux.die.net/man/1/touch|title=touch(1): change file timestamps - Linux man page|website=linux.die.net|access-date=27 January 2019|archive-date=27 March 2019|archive-url=https://web.archive.org/web/20190327025856/https://linux.die.net/man/1/touch|url-status=live}}</ref>

==See also==
* [System time](/source/System_time)
* [List of POSIX commands](/source/List_of_POSIX_commands)

==References==
{{Reflist}}

==Further reading==
*{{Cite book|author-last=McElhearn|author-first=Kirk|title=The Mac OS X Command Line: Unix Under the Hood|date=2006|publisher=[John Wiley & Sons](/source/John_Wiley_%26_Sons)|isbn=978-0470113851}}

==External links==
{{Wikibooks|Guide to Unix|Commands}}
* {{man|cu|touch|SUS}}
* {{man|1|touch|die.net}}
* {{man|1|touch|Plan 9}}
* {{man|1|touch|Inferno}}
* [http://www.linfo.org/touch.html examples showing how to use touch]

{{Unix commands}}
{{Plan 9 commands}}
{{Core Utilities commands}}
{{Use dmy dates|date=March 2014}}

Category:Standard Unix programs
Category:Unix SUS2008 utilities
Category:Plan 9 commands
Category:Inferno (operating system) commands
Category:ReactOS commands
Category:IBM i Qshell commands

---
Adapted from the Wikipedia article [Touch (command)](https://en.wikipedia.org/wiki/Touch_(command)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Touch_(command)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
