•Arnošt Havelka
Creating Files with touch
Use touch to quickly create empty files.
Start Interactive LessonThe 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
Choose a command
Terminal
C:\Users\User>touch notes.txt
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
Choose a command
Terminal
C:\Users\User>touch a.txt b.txt c.txt
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 / 3What 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.