1996 2016 Ericsson AB. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

tty - A Command-Line Interface

ETX/B/SFP C. Granbom EPK/TE (K. Boortz)
1996-11-01
A tty.xml

tty is a simple command-line interface program where keystrokes are collected and interpreted. Completed lines are sent to the shell for interpretation. A simple history mechanism saves previous lines, which can be edited before sending them to the shell. tty is started when Erlang is started with the following command:

    erl

tty operates in one of two modes:

Normal mode, in which text lines can be edited and sent to the shell.

Shell break mode, which allows the user to kill the current shell, start multiple shells, and so on.

## Normal Mode

In normal mode keystrokes from the user are collected and interpreted by tty. Most of the Emacs line-editing commands are supported. The following is a complete list of the supported line-editing commands.

Typographic conventions:

C-a means pressing the Ctrl key and the letter a simultaneously. M-f means pressing the Esc key and the letter f in sequence. Home and End represent the keys with the same name on the keyboard. Left and Right represent the corresponding arrow keys.

Key Sequence Function
Home Beginning of line
C-a Beginning of line
C-b Backward character
C-Left Backward word
M-b Backward word
C-d Delete character
M-d Delete word
End End of line
C-e End of line
C-f Forward character
C-Right Forward word
M-f Forward word
C-g Enter shell break mode
C-k Kill line
C-u Backward kill line
C-l Redraw line
C-n Fetch next line from the history buffer
C-p Fetch previous line from the history buffer
C-t Transpose characters
C-w Backward kill word
C-y Insert previously killed text
tty Text Editing

## Shell Break Mode

In this mode the following can be done:

Kill or suspend the current shell Connect to a suspended shell Start a new shell