What does Linux touch -r option do?

You can use touch -r option to provide the timestamp details of another file in touch command. By default, touch command uses the current timestamp value.

Example:

Get the current system time

Create a new empty file

Get the newly created file timestamp details

touch -r option example

Get the newly created file timestamp details

Observe, both myrefile and myfile Access and Modify times are the same though they are created at two different timestamp.

Leave a Reply