terminal.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1835 54a86a023f1b
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
929
41752712a800 Fix syntax foe RST.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 926
diff changeset
     1
.. -*- coding: utf-8; -*-
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1037
diff changeset
     2
.. include:: HEADER.rst
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
1032
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     4
===========
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     5
 Terminal.
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     6
===========
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     7
.. contents::
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     8
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Spec.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
=====
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
  http://en.wikipedia.org/wiki/C0_and_C1_control_codes
929
41752712a800 Fix syntax foe RST.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 926
diff changeset
    13
                C0 and C1 control codes
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  http://en.wikipedia.org/wiki/ECMA-48
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
                ANSI escape sequences
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    17
Check terminal capabilities.
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    18
============================
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    19
::
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    20
986
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    21
  $ infocmp -1 xterm
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    22
        ...
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    23
    colors#8,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    24
    bold=\E[1m,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    25
    blink=\E[5m,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    26
        ...
986
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    27
  $ infocmp -1L xterm    # print long name
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    28
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    29
  $ tput -Txterm colors
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    30
  8
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    31
  $ tput -Txterm blink
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    32
  ^[[5m
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    33
987
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    34
Print highlighted word::
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    35
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    36
  $ h=`tput smso`
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    37
  $ n=`tput rmso`
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    38
  $ echo ${h}xxx${n}
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    39
  xxx
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    40
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
Old hardware terminal.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
======================
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
VT102.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
------
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
VT100 is a video terminal that was made by Digital Equipment Corporation (DEC). It was introduced in
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
August 1978. Its detailed attributes became the de facto standard for terminal emulators.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
The control sequences used by the VT100 family are based on the ANSI X3.64 standard, later ECMA-48
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
and ISO/IEC 6429.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
The VT101 and VT102 were cost-reduced non-expandable follow-on products, with the VT102 including
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
the AVO and serial printer port options of the VT100.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
In 1983, the VT100 was replaced by the more-powerful VT200 series terminals such as the VT220.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
  http://en.wikipedia.org/wiki/VT102
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
VT220.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
------
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
  http://en.wikipedia.org/wiki/VT220
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
X window pseudo terminal.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
=========================
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
luit.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
-----
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
Luit is a filter that can be run between an arbitrary application and a UTF-8
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
terminal emulator. It will convert application output from the locale's
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
encoding into UTF-8, and convert terminal input from UTF-8 into the locale's
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
encoding.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
Example::
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
  $ luit -encoding 'ISO 8859-1' emacs -nw
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
Capture terminal session.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
=========================
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
1835
54a86a023f1b Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    83
Use ``script`` utility::
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
  $ script out.file
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
  sh# ....
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
  ^d
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
  $ cat out.file
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
  ...
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
1037
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    91
Installing terminal utilities.
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    92
==============================
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
1037
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    94
For Cygwin::
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    95
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    96
  $ setup.exe -p ncurses
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    97