How to Create a File in Terminal: Commands, Methods, and What to Know First

Creating a file directly in the terminal is one of those foundational skills that looks intimidating at first but quickly becomes second nature. Whether you're on macOS, Linux, or Windows (via PowerShell or WSL), the terminal gives you fast, precise control over your filesystem — no GUI required.

This guide covers the main methods, explains what each one actually does, and helps you understand which approach fits which situation.

Why Create Files in the Terminal at All?

Graphical file managers are convenient, but the terminal is faster for many workflows — especially when you're already working in a command-line environment, writing scripts, or managing files on a remote server where no desktop interface exists.

Creating files via terminal also gives you more control: you can create multiple files at once, set permissions immediately, pipe content directly into a new file, and automate repetitive tasks through shell scripts.

The Most Common Commands for Creating Files

touch — The Quick, Empty File Creator

The touch command is the most widely used method for creating a new, empty file.