ed is only capable of editing one file at a time. Follow the next example to create your first text file using ed.
/home/larry# ed a This is my first text file using Ed. This is really fun. . w firstone.txt /home/larry# q
You can verify the file's contents using the Unix concatenate utility.
/home/larry# cat firstone.txt
The above example has illustrated a number of important points. When invoking ed as above you will have an empty file. The key is used to add text to the file. To end the text entering session, a period is used in the first column of the text. To save the text to a file, the key is used in combination with the file's name and finally, the key is used to exit the editor.
The most important observation is the two modes of operation. Initially the editor is in command mode. A command is defined by characters, so to ascertain what the user's intention is, ed uses a text mode, and a command mode.