How To Use Cat Command To Append Data To a File on Linux/Unix

The cat command can be used to append data to a file on Linux or Unix. You can use the following syntax:

cat >> filename

This will open the file in append mode, and you can type or paste the data that you want to append. When you are finished, press CTRL + D to save and exit. The new data will be added to the end of the file.

Here’s an example:

cat >> file.txt
This is a line of text.
Another line of text.
CTRL + D

This will append the two lines of text to the end of the file.txt file. If the file does not exist, it will be created.

Leave a Comment