How To Create File In Linux with Different Ways? – POFTUT

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 at how to create a file from the command-line interface. Here are alternative ways to create files.

Touch

The touch command is the first choice for creating an empty file with the current user ownership.

Touch

Touch

As we can see the owner of the file is ismail and the group of the file is ismail. The permissions are set according to the umask value which is 664 in this case.

Echo

The echo command is a very useful command to put the string into the standard output. We redirect our output to a file new file will be created.

Echo

Echo

We can provide some text data to put into a newly created file.

Cat

Cat is a command especially created for concatenate files and print on the standard output.

Cat

Cat

After putting command we should press CTRL+d to exit from input mode.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)