touch (change file timestamps)

This command is used to update the timestamps of a file. Call it like this:

touch FILE

I once wanted to send someone a photo, but I didn't want them to know when the picture was taken, so I ran:

touch photo.jpg

This updated the access time, modification time and change time of photo.jpg. See the →stat command for an explanation of the three kinds of timestamps. You can update timestamps selectively by using the options -a (change access time only) and -m (change modification time only).

touch has a little peculiarity that is useful in its own right: if FILE does not exist, it is created, so touch is often used to create empty files.