terminal.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 14 Oct 2011 00:48:05 +0300
changeset 1032 4decc3e00bb6
parent 987 deddbee5fe5f
child 1037 49735af70121
permissions -rw-r--r--
Fix coding and contents.
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; -*-
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
1032
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     3
===========
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     4
 Terminal.
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     5
===========
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     6
.. contents::
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     7
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
Spec.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
=====
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
  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
    12
                C0 and C1 control codes
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  http://en.wikipedia.org/wiki/ECMA-48
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
                ANSI escape sequences
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    16
Check terminal capabilities.
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    17
============================
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
986
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    20
  $ infocmp -1 xterm
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    21
        ...
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    22
    colors#8,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    23
    bold=\E[1m,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    24
    blink=\E[5m,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    25
        ...
986
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    26
  $ infocmp -1L xterm    # print long name
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    27
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    28
  $ tput -Txterm colors
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    29
  8
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    30
  $ tput -Txterm blink
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    31
  ^[[5m
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    32
987
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    33
Print highlighted word::
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    34
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    35
  $ h=`tput smso`
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    36
  $ n=`tput rmso`
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    37
  $ echo ${h}xxx${n}
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    38
  xxx
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    39
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
Old hardware terminal.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
======================
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
VT102.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
------
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
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
    47
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
    48
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
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
    50
and ISO/IEC 6429.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
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
    53
the AVO and serial printer port options of the VT100.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
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
    56
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
  http://en.wikipedia.org/wiki/VT102
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
VT220.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
------
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
  http://en.wikipedia.org/wiki/VT220
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
X window pseudo terminal.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
=========================
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
luit.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
-----
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
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
    71
terminal emulator. It will convert application output from the locale's
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
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
    73
encoding.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
Example::
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
  $ luit -encoding 'ISO 8859-1' emacs -nw
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
Capture terminal session.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
=========================
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
Use *script* utility::
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
  $ script out.file
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
  sh# ....
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
  ^d
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
  $ cat out.file
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
  ...
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