# 3 Entering commands ¶

Most commonly, you will enter Maxima commands in the last input line that appears on the text Window. That text will be rendered in green. If you press enter, without having written a command-termination character (either ‘`;`’ or ‘`$`’) at the end, the text will remain green and you can continue to write a multi-line command. When you type a command-end character and press the enter key, the text will become blue and a response from Maxima should appear in black. You can also use the key combination `Ctrl-j` to move to a new line without sending the input for Maxima evaluation yet. If you want to clear all the current input (in green), even if it spans several lines, use the key combination `Ctrl-u`.

If you move the cursor over the `(%i1)` input label, or any other label or output text (in black), you will not be able to type any text there; that feature will prevent you from trying to enter a command in the wrong place, by mistake. If you really want to insert some additional text to modify Maxima’s output, and which will not be interpreted by Maxima, you can do that using cut and paste (we will cover that later).

You can also write a new input command for Maxima on top of a previous input line (in blue), for instance, if you do not want to write down again everything but just want to make a slight change. Once you press the enter key, the text you modified will appear at the last input line, as if you had written it down there; the input line you modified will continue the same in Xmaxima’s and Maxima’s memory, in spite of having changed in the screen.

For example, suppose you entered ‘`a: 45;`’ in input line `(%i1)`, and something else in `(%i2)`. You then move up over the `(%i1) a: 45;` and change the 5 for an 8. Once you press enter, you will have in the screen `(%i1) a: 48;` and `(%i3) a: 48;`. But if you write, in the current input line, `(%i1)` the original input ‘`a: 45;`’ will reappear. If you navigate through the input lines history (see next section), you will also see that the first input keeps its original value.

## 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.

## 3.2 Cutting and pasting ¶

You can cut or copy a piece of text that you select, from anywhere on text window; not just from the input lines but also from the output text in black.

To select the text, you can drag the cursor with the mouse while you keep its left button depressed, or you can hold the `shift` key with one finger, while you move the cursor with the mouse or with the arrow keys.

Once you have selected the text, you can either cut it, with `Ctrl-x`, or copy it to an internal buffer, with `Ctrl-c`. Instead of those key combinations, you can also use two options that appear inside the `Edit` menu.

The text that has been cut or copied more recently can be pasted anywhere, even in the output fields, using `Ctrl-v` or an option in the `Edit` menu.

There is a command similar to ‘`cut`’, called ‘`kill`’ (`Ctrl-k`, with two major differences: it only works in input fields (blue or green) and instead of cutting a text that was selected, it will cut all the text from the cursor until the end of the input line where the cursor is. The command ‘`Clear input`’ (`Ctrl-u`) is similar to ‘`kill`’, but it will cut the whole input line.

To paste the last text that you have cut with either ‘`kill`’ or ‘`clear input`’, you should use the ‘`yank`’ command, `Ctrl-y`. If you prefer, you can use entries in the `Edit` menu to kill, clear input and yank.

## 3.3 Other key combinations ¶

There are other useful key combinations, which are not particular to Xmaxima, but are defined in most Tcl/Tk programs:

`Ctrl-f`

  The same as the right arrow key.

`Ctrl-b`

  The same as the left arrow key.

`Ctrl-p`

  The same as the up arrow key.

`Ctrl-n`

  The same as the down arrow key.

`Ctrl-a`

  Moves to the first character in a line (either input or output)

`Ctrl-e`

  Moves to the last character in a line (either input or output)

`PageUp`

  Moves one page up

`PageDown`

  Moves one page down

`Home`

  Moves the first character in the text window.

`End`

  Moves to the last character in the text window.

This document was generated on May 18, 2026 using gtexi2any.