Editing a file changes its modification time, and sometimes I’d rather it didn’t. A notes file where I only fixed a typo, or a config I just reformatted, suddenly sits at the top of ls -lt as if it were brand new. touch can put the old time back.
Most people know touch for creating empty files. Give it -r (--reference) and it copies the access and modification times of another file instead of using the current time:
cp -p notes.md notes.orig.md
sed -i 's/teh/the/g' notes.md
touch -r notes.orig.md notes.md
The cp -p keeps the original time on the spare copy, sed -i makes the edit (and bumps the time), and the last line puts the old time back. Anything that sorts or syncs by modification date then treats the file as it did before.
If you know the time rather than having a file with it, -d takes a date string such as touch -d "2026-11-01 09:00" notes.txt. Add -m to change only the modification time, or -c so touch never creates a file when the name has a typo in it.
The caveat is the third timestamp. Linux also keeps a change time (ctime), and the utimensat(2) man page says setting the other two always sets ctime to now. You can see it with stat, and backup tools or find -cnewer that look at ctime will still notice the file was touched. You also need to own the file (or be root) to set an arbitrary time on it.
Further reading: touch(1) manual page, utimensat(2) manual page