What does Linux touch -t option do?

The touch -t option is similar to touch -d option, but instead of passing any valid timestamp format like in -d option, -t option only accepts timestamp in [[CC]YY]MMDDhhmm[.ss] format.

Example:

Get the current system time

Create a new empty file

Get the new file creation time

touch -t option example

Get the file creation time

Observe, the timestamp of myfile changed to “Jan 26 22:30”

Leave a Reply