touch
FilesBeginner In simulator In real LinuxCreate 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-create | Don't create files that don't exist |
| -a | Change only the access time |
| -m | Change only the modification time |
| -t STAMP | Use this time: [[CC]YY]MMDDhhmm[.ss], e.g. 202601150930 |
| -d / --date STRING | Use a time written in words, e.g. "2026-01-15 09:30" or "2 days ago" |
| -r / --reference FILE | Use another file’s times |
| -h / --no-dereference | Change the symbolic link itself, not what it points to |