Back to Blog
Arnošt Havelka

Creating Files with touch

Use touch to quickly create empty files.

Start Interactive Lesson
Creating Files with touch

The touch command creates empty files instantly. It's the fastest way to create a new file without opening an editor.

Create a Single File

Use touch followed by a filename to create an empty file.

Try the command

Create a new file!

Build the command
touchfilename
touchCreate file - makes an empty file with the specified name.
Terminal
C:\Users\User>touch filename

Create instantly:

Command Prompt
Documents Downloads
C:\Users\User>ls

Create Multiple Files

Create several files at once by listing them after touch.

Try the command

Create multiple files!

Build the command
touchfile1file2file3
file1 file2 file3Multiple files - creates all of them at once.
Terminal
C:\Users\User>touch file1 file2 file3

Batch creation:

Command Prompt
existing.txt
C:\Users\User>ls

Also Updates Timestamps

If the file already exists, touch updates its modification time without changing its contents.

Command Prompt
-rw-r--r-- 1 user group 1024 Apr 1 old.txt
C:\Users\User>ls -l old.txt

Knowledge Check

1 / 3

What does touch do?

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

Copying Files and Directories

Master cp to copy files and recursive directory structures.