File Operations

touch

Create empty files or update file access and modification timestamps.

Synopsis

syntax
touch [OPTION]... FILE...

Examples

Create an empty file or update timestamp
touch newfile.txt
Set timestamp to Jan 1 2023 12:00
touch -t 202301011200 file.txt
Copy timestamp from ref.txt to target.txt
touch -r ref.txt target.txt
Create five numbered files
touch file{1..5}.txt

Common options

FlagDescription
-aChange only access time
-mChange only modification time
-tUse specified time instead of current time
-cDo not create file if it does not exist
-rUse reference file's timestamp

About touch

The `touch` command create empty files or update file access and modification timestamps. File operation commands are essential for navigating and managing the Linux filesystem.

They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.

The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man touch`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More File Operations Commands

Other commands in the File Operations category

Related tools