Examples of how to create a new file in Linux:
Create a new file using touch
To create a new file in linux a straightforward solution is to use the command touch:
touch accept options such as:
-c or –no-create: Not creating the file if it doesn’t exist.
-m: Changes the modification time.
Using linux > output operator
Another solution is to use the operator >:
linux_cmd > filename
ls > results.txt
will create a file called results.txt with the results of the ls command.
Using a text editor
it will open vi text editor. To enter some text just press touch "i" (as insert).
Then press the touch "Esc" and :wq to write and save the file.