Javatpoint Logo
Javatpoint Logo

Linux cat command (to create)

The 'cat' command can be used to create a new file with greater than sign (>).

Syntax:

Example:

Linux cat Create1

In the above snapshot, we have created a new file called "javatpoint". Now let's see how to create it.

Type the command "cat >javatpoint" and press 'enter'. You will be directed to the next line.

Press 'enter' after every line and you will be directed to the next line. To save your file, go to the next line, press 'ctrl+d' and your file will be saved.

To Append the Content of A File

The 'cat' command with double greater than sign (>>) append (add something in the last of a file) something in your already existing file.

Syntax:

Example:

Linux cat Creat2

Look at above snapshot, a new line at the end is added in the file 'javatpoint'. After passing "cat >> javatpoint" command, type the lines as much as you want to add. To save the file press 'ctrl + d'.

Next TopicLinux cat Copy




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA