Back to Blog
Arnošt Havelka

Creating Files with touch

Use touch to quickly create empty files.

Start Interactive Lesson
Creating Files with touch

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.

Usage:touchfilename
touch
Create file - makes an empty file with the specified name.

Create instantly:

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

Create Multiple Files

Create several files at once by listing them after touch.

Usage:touchfile1file2file3
file1 file2 file3
Multiple files - creates all of them at once.

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 Microsoft Learn and Windows documentation links provide authoritative details for the commands used in this article.

Up Next

Creating Directories with mkdir

Master mkdir to create single and nested directory structures.