Create a new file in ubuntu command line
To create a new file in the Ubuntu command line, you can use the touch
command followed by the name of the file you want to create.
For example, to create a file named example.txt
, you would use the following command:
touch example.txt
This will create a new file named example.txt
in the current directory.
If you want to create a file in a specific directory, you can specify the path to that directory followed by the name of the file. For example:
touch /path/to/directory/example.txt
This will create a new file named example.txt
in the /path/to/directory
directory.
You can also use the nano
or vim
editor to create a new file. For example:
nano example.txt
This will open the nano
editor and create a new file named example.txt
. You can then type in the file and save it when you're done.
Note: If you want to create a file with a specific content, you can use the echo
command followed by the content and the name of the file. For example:
echo "Hello World!" > example.txt
This will create a new file named example.txt
with the content "Hello World!".