Create new file cmd
To create a new file using the command line, you can use the following commands:
Using the touch
command:
touch new_file.txt
(replacenew_file.txt
with the desired name and extension of your file)
This command creates a new empty file with the specified name and extension.
Using the echo
command:
echo "Hello World!" > new_file.txt
(replaceHello World!
with the desired content of your file andnew_file.txt
with the desired name and extension of your file)
This command creates a new file with the specified name and extension, and writes the specified content to it.
Using the nano
or vim
editor:
nano new_file.txt
(replacenew_file.txt
with the desired name and extension of your file)vim new_file.txt
(replacenew_file.txt
with the desired name and extension of your file)
These commands open the specified file in the nano or vim editor, respectively. You can then type in the content of your file and save it when you're done.
Note: Make sure to replace new_file.txt
with the desired name and extension of your file in the above commands.