Writing Files in Unix

by Mark Marucot on May 9, 2008

To write files in Unix, the syntax is

echo   >

Example

echo "This is my message."  > myfile.txt

To add another line in the myfile.txt, use the following syntax.

echo "This is my second message."  >>  myfile.txt

You may notice that double greater than sign (>>) is used instead of single greater than sign. This means that the message is written in append mode.

Let’s open the myfile.txt by using the following command.

tail  myfile.txt

The content of the myfile.txt should have the following.

This is my message.
This is my second message.

Related Posts

Leave a Comment

Previous post:

Next post: