Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21d12265aca5cd4

Jump to content

Talk:touch (command)

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 6 months ago by Gpvos in topic -f option

name

[edit]

Any idea why its called "touch" ? Jay 11:57, 6 Mar 2004 (UTC)

Because you "touch" the file. You don't change it at all, it's as if you reached out and touched it with one finger rather than grabbed it and moulded it into a different shape. Not easy to explain, but the concept works perfectly for me, and presumably for a lot of other Unix geeks too. PeteVerdon Preceding undated comment added 20:37, 25 May 2005‎
You can also think of it as if you were "touching" the file system - almost as if you were to "prod" it there so that if a file didn't already exist, it now does, and if one previously existed, then it would look new. Preceding unsigned comment added by 216.199.190.150 (talk) 20:48, 10 August 2005 (UTC)Reply
I think that the name is a pun to Michaelangelos work `The Creation of Adam' where God creates Adam with a touch of the finger.  Preceding unsigned comment added by Cluzz (talkcontribs) 15:33, 25 April 2020 (UTC)Reply

Examples

[edit]

Maybe we should reconsider the date and time in the examples? It seems kind of morbid. 'Net 22:51, 10 April 2007 (UTC)Reply

Changed.--Unixguy 10:32, 15 April 2007 (UTC)Reply

windows version

[edit]

Is there a Windows cmd under DOS that does the same thing? 65.65.71.253 (talk) 16:45, 25 June 2009 (UTC)Reply

http://en.wikipedia.org/wiki/Touch_%28Unix%29#External_links

Prompt in Examples Section

[edit]

Isn't the # a prompt for the superuser? I'd think it should be a $, the prompt for normal users in Bourne shells. —Preceding unsigned comment added by BZRatfink (talkcontribs) 01:55, 15 August 2010 (UTC)Reply

Agreed. I did not see your comment before editing the page, but I have changed it to $. Excessive use of the root account is very common in hobbyist Linux users, but far less so by professional system admins, especially those who first learned their skills on true Unix operating systems like AIX, HP-UX, Solaris etc. Drkirkby (talk) 09:14, 20 February 2012 (UTC)Reply

Is there a way to modify the creation date of symbolic links?

[edit]

'touch' does not work on links, but is there any way to change the creation date of links? Drkirkby (talk) 09:15, 20 February 2012 (UTC)Reply

The simple way to change the date on a link is to remove it and recreate it. There is some controversy over the concept of a creation date for Unix files. It's really not the creation date of the file or link, it's the inode modification date.

This does not describe the Unix touch command

[edit]

Many of the examples given will not work on Solaris, which is a certified Unix operating system. The reason for this is that many of the examples are making use of GNU extensions, which are not in the Unix standard. Here is the specification of touch http://pubs.opengroup.org/onlinepubs/7990989775/xcu/touch.html

I will remove the non-standard examples. — Preceding unsigned comment added by 109.145.45.146 (talk) 20:08, 26 January 2014 (UTC)Reply

-f option

[edit]

In modern versions of touch, the -f option is ignored. This is beyond the scope of the Wikipedia article, but out of curiosity I looked up what it used to do: in the far past, after trying a couple of other methods to change the file's modification time, as a last resort touch used to actually open the file, read its first byte and then write it again. If, while doing so, the file could not be opened in read-write mode and the -f option was given, it tried to change the file mode (chmod) to 0666, tried again to open it, did the read-write trick, and tried to change the file mode back to its original value afterwards. In the source history of NetBSD you can see when the option's effect was removed, see the commits "remove read-write code because it's dangerous." and "-f no longer has effect. from Snader_LB on irc." from 2009 and 2011 in the NetBSD history here. Again, I think this is out of scope for this Wikipedia article, but I just wanted to document it somewhere, which I now did here.  gpvos (talk) 22:43, 17 January 2026 (UTC)Reply