Erlang -- tty - A command line interface

User's Guide
Reference Manual
Release Notes
PDF
Top

Erlang Run-Time System Application (ERTS)
User's Guide
Version 7.3

Expand All
Contract All

Chapters

- Communication in Erlang
  - Top of chapter
  - Passing of Signals
  - Synchronous Communication
  - Implementation
- Time and Time Correction in Erlang
  - Top of chapter
  - New Extended Time Functionality
  - Terminology
  - Introduction
  - Time Correction
  - Time Warp Safe Code
  - Time Warp Modes
  - New Time API
  - Support of Both New and Old OTP Releases
- Match specifications in Erlang
  - Top of chapter
  - Grammar
  - Function descriptions
  - Variables and literals
  - Execution of the match
  - Differences between match specifications in ETS and tracing
  - Examples
- How to interpret the Erlang crash dumps
  - Top of chapter
  - General information
  - Scheduler information
  - Memory information
  - Internal table information
  - Allocated areas
  - Allocator
  - Process information
  - Port information
  - ETS tables
  - Timers
  - Distribution information
  - Loaded module information
  - Fun information
  - Process Data
  - Atoms
  - Disclaimer
- How to implement an alternative carrier for the Erlang distribution
  - Top of chapter
  - Introduction
  - The driver
  - Putting it all together
- The Abstract Format
  - Top of chapter
  - Module Declarations and Forms
  - Atomic Literals
  - Patterns
  - Expressions
  - Clauses
  - Guards
  - Types
  - The Abstract Format After Preprocessing
- tty - A command line interface
  - Top of chapter
  - Normal Mode
  - Shell Break Mode
- How to implement a driver
  - Top of chapter
  - Introduction
  - Sample driver
  - Compiling and linking the sample driver
  - Calling a driver as a port in Erlang
  - Sample asynchronous driver
  - An asynchronous driver using driver_async
- Inet configuration
  - Top of chapter
  - Introduction
  - Configuration Data
  - User Configuration Example
- External Term Format
  - Top of chapter
  - Introduction
  - Distribution header
  - ATOM_CACHE_REF
  - SMALL_INTEGER_EXT
  - INTEGER_EXT
  - FLOAT_EXT
  - ATOM_EXT
  - REFERENCE_EXT
  - PORT_EXT
  - PID_EXT
  - SMALL_TUPLE_EXT
  - LARGE_TUPLE_EXT
  - MAP_EXT
  - NIL_EXT
  - STRING_EXT
  - LIST_EXT
  - BINARY_EXT
  - SMALL_BIG_EXT
  - LARGE_BIG_EXT
  - NEW_REFERENCE_EXT
  - SMALL_ATOM_EXT
  - FUN_EXT
  - NEW_FUN_EXT
  - EXPORT_EXT
  - BIT_BINARY_EXT
  - NEW_FLOAT_EXT
  - ATOM_UTF8_EXT
  - SMALL_ATOM_UTF8_EXT
- Distribution Protocol
  - Top of chapter
  - EPMD Protocol
  - Distribution Handshake
  - Protocol between connected nodes
  - New Ctrlmessages for distrvsn = 1 (OTP R4)
  - New Ctrlmessages for distrvsn = 2
  - New Ctrlmessages for distrvsn = 3 (OTP R5C)
  - New Ctrlmessages for distrvsn = 4 (OTP R6)

# 7 tty - A command line interface

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

erl

tty operates in one of two modes:

- normal mode, in which lines of text can be edited and sent to the shell.

- shell break mode, which allows the user to kill the current shell, start multiple shells etc. Shell break mode is started by typing Control G.

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

Note: The notation C-a means pressing the control key and the letter a simultaneously. M-f means pressing the ESC key followed by the letter f. Home and End represent the keys with the same name on the keyboard, whereas 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

Table 7.1: tty text editing

### 7.2 Shell Break Mode

tty enters shell break mode when you type Control G. In this mode you can:

- Kill or suspend the current shell

- Connect to a suspended shell

- Start a new shell