27

I already have a file named param.txt with some data on it. If I run touch param.txt in the same folder will my data get lost?

Kusalananda
  • 333,661
Rajesh
  • 279

1 Answers1

47

The contents of the file will not be lost, and it won't even be modified. The only thing that happens when you run touch on an already existing file is that the file's access and modification timestamps are updated to the current time.

This is the primary use for the touch utility and this is explained in the touch manual (man touch).

Kusalananda
  • 333,661