[TUHS] Origins of touch(1)

Joseph Holsten joseph at josephholsten.com
Mon Jun 9 03:44:21 AEST 2025


A TikTok user was asking the history of the touch(1) command: https://www.tiktok.com/t/ZTjgSMyAQ/

Unix history repo let me find the first occurrence in V7: https://github.com/dspinellis/unix-history-repo/blob/Research-V7-Snapshot-Development/usr/src/cmd/touch.c

But looking at ls source in V6, it’s clear that stat(2) had st_mtime so touch would have been useful earlier. I notice make was added at the same time, which cares significantly about mtime. Was that the impetus?

(Also, wow just writing a single char! Compared to present day impls which give fine grained control to modify mtime & atime, the original seems both indirect for the purpose and delightfully literal.)

--
Joseph Holsten
http://josephholsten.com
mailto:joseph at josephholsten.com
tel:+1-360-927-7234


More information about the TUHS mailing list