To create a file in Unix, you can use the touch
command. The touch
command allows you to create an empty file with a specified name. Here’s the basic syntax:
touch file_name
Replace file_name
with the desired name for the new file. For example, to create a file named example.txt
, you can use the following command:
touch example.txt
You can also create a file and immediately edit it using a text editor like nano
or vi
:
nano file_name
or
vi file_name
This will open the file in the specified text editor, where you can add or modify content.