How To Create File In Linux with Different Ways?
Sometimes creating a file empty or with a little content can be important. In this post we will look how to create a file from command line interface. Here is alternative ways to create files.
Touch command is the first choice for creating empty file with the current user ownership.
$ touch ex1
Echo command is very useful command to put string into the standard output. I we redirect our output to a file new file will be created.
$ echo "" > ex2
We can provide some text data to put into newly created file.
$ echo "Some data" > ex3
Cat is a command especially created for concatenate files and print on the standard output.
$ cat > ex4
After putting command we should press CTRL+d to exit from input mode.