terminal.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:46:36 +0200
changeset 1905 fba288d59662
parent 1835 54a86a023f1b
child 1912 8b81a8f0f692
permissions -rw-r--r--
Include only local subsections into TOC. This prevent duplication of TOC when build single page HTML document. Also this make unnecessary CSS hack to hide document title as top level section.
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::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1835
diff changeset
     8
   :local:
1032
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 987
diff changeset
     9
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
Spec.
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
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  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
    14
                C0 and C1 control codes
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  http://en.wikipedia.org/wiki/ECMA-48
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
                ANSI escape sequences
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    18
Check terminal capabilities.
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
::
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    21
986
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    22
  $ infocmp -1 xterm
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    23
        ...
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    24
    colors#8,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    25
    bold=\E[1m,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    26
    blink=\E[5m,
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    27
        ...
986
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    28
  $ infocmp -1L xterm    # print long name
858ecbc30566 print long name
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
    29
985
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    30
  $ tput -Txterm colors
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    31
  8
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    32
  $ tput -Txterm blink
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    33
  ^[[5m
6a75b1b2976b Check terminal capabilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
    34
987
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    35
Print highlighted word::
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    36
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    37
  $ h=`tput smso`
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    38
  $ n=`tput rmso`
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    39
  $ echo ${h}xxx${n}
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    40
  xxx
deddbee5fe5f Print highlighted word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 986
diff changeset
    41
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
Old hardware terminal.
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
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
VT102.
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
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
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
    49
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
    50
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
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
    52
and ISO/IEC 6429.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
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
    55
the AVO and serial printer port options of the VT100.
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
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
    58
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  http://en.wikipedia.org/wiki/VT102
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
VT220.
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
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
  http://en.wikipedia.org/wiki/VT220
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
X window pseudo terminal.
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
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
luit.
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
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
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
    73
terminal emulator. It will convert application output from the locale's
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
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
    75
encoding.
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
Example::
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
  $ luit -encoding 'ISO 8859-1' emacs -nw
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
Capture terminal session.
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
=========================
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
1835
54a86a023f1b Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    84
Use ``script`` utility::
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
  $ script out.file
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
  sh# ....
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
  ^d
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
  $ cat out.file
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
  ...
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
1037
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    92
Installing terminal utilities.
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    93
==============================
926
25c9a1591ba1 Capture terminal session.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
1037
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    95
For Cygwin::
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    96
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    97
  $ setup.exe -p ncurses
49735af70121 Installing terminal utilities.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
    98