Skip to content

Getting started

Giovanni Zaccaria edited this page Apr 3, 2021 · 7 revisions

TextEd is a command-line text editor for Linux, inspired by the command-line editor ed, but with a simpler and more intuitive interface. It can be installed via the packages available in the various releases or by following the instructions for installing it available in the README. Once correctly installed, TextEd can be launched with the command:

$ texted

If you do not specify a file name to open, a.txt will be assumed by default. To open a file, type its name after the command texted.

Once in the editor you will be presented with a similar screen:\

TextEd

At the top we find a yellow sign welcoming us, informing us which version of the software we are using. On the next line, a text indicates the name of the file and the current line selected. The green color indicates that we have permission to write to and read from the file. From here we can enter commands to start writing and editing our file.

Typing the command i will enter insert mode, a mode that allows us to enter text until we press the ESC key. To exit you must press enter after typing the ESC key. What we have written is saved in memory until we perform a write operation. Note that if the file was not empty, what we have written will be concatenated with what was already written, without the program inserting spaces or newlines.

Insert mode

Once the text has been entered we can display it with the p command and its variants. To learn more about the print command, type h, which will output a list of useful commands we can use, followed by a brief description and grouped by affinity.

Print command

Suppose the second line doesn't satisfy us: now we want to change Here is the second line to Here we go with the second line. Nothing could be simpler. The s command replaces one expression with another. We can use it by writing:

> s/expression to replace/new expression/

But be careful, the number next to file.txt tells us that we have selected the first line. To edit the second line we will have to move to this one. To do this, just use the command l followed by the number of the line you want to move to. In our case we would write:

> l2

or alternatively:

> l 2

Finally, we reprint the file to check whether the change has been made correctly. Here is the result:

Subsitute command

Clone this wiki locally