Create an empty new file in terminal
To create a new empty file in the terminal, you can use the following command:
touch filename.txt
Replace filename.txt
with the name you want to give your file. This will create a new file with the specified name and extension (in this case, .txt
).
If you want to create a file with a specific directory, you can specify the path along with the filename. For example:
touch /path/to/newfile.txt
Make sure to replace /path/to/
with the actual directory path where you want to create the file.
Alternatively, you can also use the nano
or vim
editor to create a new file. For example:
nano filename.txt
This will open the nano
editor and create a new file with the specified name. You can then type some text and save the file by pressing Ctrl+X
and then Y
to confirm.
Note: The touch
command is a Unix command that is used to create a new file or update the timestamp of an existing file. It is commonly used to create new files or to update the timestamp of a file to the current time.