5 tty - A command line interface

本文介绍TTY的使用方法及其快捷键,包括正常模式和shell断点模式下的文本编辑指令,如行首(C-a)、行尾(C-e)、向前字符(C-f)等。此外还介绍了如何通过快捷键进入shell断点模式并进行当前shell的操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

记住这些快捷键shell操作的时候速度快很多!


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

5.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.
tty text editing Key Sequence Function
C-a Beginning of line
C-b Backward character
M-b Backward word
C-d Delete character
M-d Delete word
C-e End of line
C-f Forward character
M-f Forward word
C-g Enter shell break mode
C-k 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-y Insert previously killed text
5.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
/** * pl011_console_match - non-standard console matching * @co: registering console * @name: name from console command line * @idx: index from console command line * @options: ptr to option string from console command line * * Only attempts to match console command lines of the form: * console=pl011,mmio|mmio32,<addr>[,<options>] * console=pl011,0x<addr>[,<options>] * This form is used to register an initial earlycon boot console and * replace it with the amba_console at pl011 driver init. * * Performs console setup for a match (as required by interface) * If no <options> are specified, then assume the h/w is already setup. * * Returns 0 if console matches; otherwise non-zero to use default matching */ static int pl011_console_match(struct console *co, char *name, int idx, char *options) { unsigned char iotype; resource_size_t addr; int i; /* * Systems affected by the Qualcomm Technologies QDF2400 E44 erratum * have a distinct console name, so make sure we check for that. * The actual implementation of the erratum occurs in the probe * function. */ if ((strcmp(name, "qdf2400_e44") != 0) && (strcmp(name, "pl011") != 0)) return -ENODEV; if (uart_parse_earlycon(options, &iotype, &addr, &options)) return -ENODEV; if (iotype != UPIO_MEM && iotype != UPIO_MEM32) return -ENODEV; /* try to match the port specified on the command line */ for (i = 0; i < ARRAY_SIZE(amba_ports); i++) { struct uart_port *port; if (!amba_ports[i]) continue; port = &amba_ports[i]->port; if (port->mapbase != addr) continue; co->index = i; port->cons = co; return pl011_console_setup(co, options); } return -ENODEV; }
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值