Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Create a file – Terminal


To create a file using your terminal, use the touch command:

touch file-name


The touch command is used to create files in the terminal. If the file you are trying to create already exists in the folder you are in, it simply updates the modification and access time of the file.

To create a file named index.html, enter the following command in your terminal:

touch index.html

To check that the file was created, enter the following command to print out the contents of your current folder:


You should see the file listed in the output along with any other files and folders inside the current directory.

Create multiple files

To create multiple folders, pass in multiple folder names as arguments to the touch command, like this:

touch index.html about.html

The above command will create files named index.html and about.html.


Try the following command in your project folder:

touch main.css


Run the man touch command in your terminal to learn more.

Back to: Terminal Reference > Terminal Basic Commands