How to create a new file using Linux touch command

Linux includes a lot of useful commands to simplify the tasks. Linux commands can do anything, whether creating new directories or making changes in the system. You can also generate bash scripts from the terminal as it only requires the touch command.

A touch command creates, changes and modifies the timestamps of certain files. However, some beginners do not know the methods of using the touch command to create files from the terminal. Please read this guide if you also want to know how to create a new file using the touch command. Let’s start!

How to create a new file with Touch Command in Linux

The touch command has different options. Let’s start with the basic syntax you can try in the Linux terminal:

touch <possibility> <File name or directory name>

You can create a bash file using the touch command. For the example we write a bash Script i.e. by the following command:


Likewise, you can use the touch command to create a new file in a specific directory. For example, use the following command to create a file in the Documents directory:

CD ~/documents

If you want to create multiple files, add the name of the files in the single command. In this example we can create,, and via the following command:


Sometimes you try to create a file but don’t know if it exists in the system. In this case, use the -c option:

touch -c

As mentioned earlier, the touch command is not limited to file creation as it includes various options such as:

Options Description -a Changes the file access time. -c Don’t create file if it exists. -d Store the date as a STRING. -m Change the modification time of the file. -h Make changes to a file’s symbolic links instead of a referenced file. -t Save the file in [CCYY]MMDDhhmm instead of the current time. -r Store the time of the file instead of the current time.

Additionally, you can use the following command to learn more about the touch command:

touch –H


touch –Help


This is about creating a new file using the touch command in Linux. The touch command includes various options to create and modify the files and directories from the terminal. We’ve focused solely on creating files using the touch command in this guide. In addition, we used various examples to create the bash script via the touch command. Many Linux users use the cat command instead of the touch command, but there are some differences between them. We’ve uploaded thousands of guides to our official Linuxhint site, so please check them out.

Related Posts