# Introduction to ed

For as well-loved as the Vi command is, it's the `ed` command that's called the standard Unix text editor.
It was the very first text editor for Unix, and it's available on even the most modern of Linux systems.
Unlike text editors you may be used to on Linux or any other system, `ed` doesn't open a window or even a screen of its own.
That's because it's a functional editor that you can control either interactively or with a script.
If you're already [familiar with `sed`](https://www.redhat.com/sysadmin/manipulating-text-sed), then you'll find `ed` easy to learn.
If you're new to both, `ed` can provide you with a new perspective on how you can process and modify data on your system.

## Launching ed

When you first launch `ed`, you get no feedback or prompt.
That's the expected behaviour, so don't panic.
Your system hasn't crashed, `ed` is just waiting for your instructions.

```
$ ed

```

To get `ed` to be a little more visual, use the `p` command to create a prompt.
Type the letter `p` followed by the **Return** or **Enter** key:

```bash
$ ed
p
?
```

The question mark (`?`) is the default `ed` prompt.

## The `ed` buffer

While `ed` is active, it uses a place in memory to store data.
This is called a _buffer_.
This is significant because you're not editing a file directly.
You're editing a copy of file data placed into the buffer.
As long as you save the buffer when you're done, any changes you make to the data is preserved.
Should you exit `ed` without writing changes to a file on disk, though, all changes are lost because they only existed in the buffer.
It's no different than closing any application without saving changes first, but `ed` doesn't warn you, so keep it in mind.

## Generating text with ed

Similar to the `vi` editor, `ed` starts out in *command mode*.
This means you can issue commands to the editor, as you did to display a prompt, but you can't writing or edit text without issuing a command first.

You can append text to the current buffer using the `a` command followed by the **Return** or **Enter** key.
Whatever text you type into the terminal now gets appended to the buffer.
Stop `ed` from appending text to the buffer by typing a solitary dot (`.`) on its own line.

This example adds two lines (`[myconfig]` and `widget=True`) to the buffer:

```bash
?
a
[myconfig]
widget=True