To create or update the test.txt file using the following command:
$ cat << EOF > test.txt
This is the first line.
This is the second line.
EOF- The
cat << EOF > test.txtcommand creates (or updates if the file already exists) a file namedtest.txtand writes the specified content into it. - Everything between
EOFand the secondEOFis written into the file. - This command adds two lines to
test.txt:- "This is the first line."
- "This is the second line."
After running this command, your test.txt file will contain the following:
This is the first line.
This is the second line.