Back to the command reference

touch

FilesBeginner In simulator In real Linux

Create empty files or update timestamps

Name: touch: "touch" a file to update its timestamps

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

touch sets a file's access and modification times to now (or to a time given with -d or -t). If the file doesn't exist, it creates an empty one, which is what it is most often used for.

Build tools such as make decide what to rebuild from modification times, so touching a file forces it to be rebuilt.

Syntax

touch [OPTION]... FILE...

Common options

-c / --no-createDon't create files that don't exist
-aChange only the access time
-mChange only the modification time
-t STAMPUse this time: [[CC]YY]MMDDhhmm[.ss], e.g. 202601150930
-d / --date STRINGUse a time written in words, e.g. "2026-01-15 09:30" or "2 days ago"
-r / --reference FILEUse another file’s times
-h / --no-dereferenceChange the symbolic link itself, not what it points to

Examples

  • $ touch notes.txt

    Create an empty file (or just update its time)

    Explain
  • $ touch a.txt b.txt c.txt

    Create several files at once

    Explain

Related