Posted on 4th March 2024
Let me explain to you the four different ways to create a new file in Linux.
Using touch command is the simplest way to create a file; we can easily run the touch command to create a new file.
Syntax: $ touch file.txt
Redirection permits you to catch the output of command plus transfer it as input into different command either a file.
To create a distinct file run the cat command accompanied by the operator of the redirection > also that name of that file you need to create. Press Enter Copy the text and once you are completed doing this process, then press the CRTL+D to store the files.
Syntax: $ cat > file.txt
To build a new file, manage the echo command accompanied by the text you desire to print and utilize the operator of the redirection > to write the output over the file you need to build.
Syntax: $ echo > file.txt
If you want to learn more you can visit here: Linux Advanced Functions and Commands
STILL GOT QUERIES?