Skip to main content
LESSON 1 of 5//File Operations

Creating files with touch

The touch command creates empty files. It's the simplest way to create a new file from the command line. If the file already exists, touch updates its modification timestamp without changing its contents.

Creating fileszsh // interactive
~touch index.html
~ls -l index.html
-rw-r--r-- 1 dev staff 0 Apr 13 09:00 index.html
# Create multiple files at once
~touch style.css app.js README.md
# You can also create files with content using echo
~echo '# My Project' > README.md

Quick project setup

Combine mkdir and touch to scaffold a project: mkdir -p src/components && touch src/index.ts src/components/App.tsx

PRACTICE//Try the commands from this lesson
INTERACTIVE_TERMINAL//sandbox
Practice terminal — try the commands from this lesson!
Type 'help' for available commands. Tab completion not available in simulator.
Try: