UnixDroid

Files · Linux command

touch command in Linux

What does touch do?

touch creates an empty file if it does not exist, or updates the last-modified time of an existing file.

touch file…

Most useful options

OptionWhat it does
-tset a specific time stamp
-r refcopy the time stamp of another file

touch examples

$ touch notes.txt Try it ›

create an empty file

$ touch a.txt b.txt Try it ›

create two files

In security work

Time stamps can be changed with touch, so investigators never trust them alone.

Questions about touch

Does touch overwrite a file?

No. If the file exists, only its time stamp changes; the content stays.