## 3.1 Input lines history

When the cursor is at the end of the last `(%i)` label, you can use the key combinations `Alt-p` and `Alt-n` to recover the previous or next command that you entered. If you have just pressed `Alt-n`, the ‘`next`’ command means the first one you entered; but if you press it again it will mean the second one and so on.

In the same way, if you press `Alt-p` repeatedly, until you reached the first input, it will then continue to the last command you entered. Once you get on the screen the command that you were looking for, it will appear in green, as if you would have just type it, and you can modify it before you press enter.

Those two key combinations can also be used to search for a previous input line with a particular string in it. You first write down the string to search, and then press `Alt-p`, to search backwards, or `Alt-n` to search forward. Pressing those key combinations repeatedly will allow you to cycle through all the lines that contain the string. If you want to try a different string in the middle of the search, you can delete the current input, type the new string, and start the search again.

This document was generated on October 10, 2023 using gtexi2any.