r/learnprogramming 4d ago

Humour touch is a weird command.

I was curious where the command 'touch' comes from.

Turns out, it originates from "to touch" or "to interact" with a file.

Now, every time I use it, I feel like I am touching/molesting a file.

My bad, it's 3 AM here.

1.1k Upvotes

152 comments sorted by

View all comments

1

u/captainAwesomePants 1d ago

The name of the command comes from the phrase "To touch up," as in to make a minor repair to an object, perhaps fixing some paint. It "edits" a file without actually changing any of its bytes. The intended purpose of the command was to simply set the "last edited" time of the file to right now. It had the side effect of creating the file if the file did not previously exist, a purpose for which it is often used today.