64

I tried vt100, vt102, vt220, and xterm by using top.

But I can't find their difference. Is there any other term type? What's their difference?

4 Answers 4

86

xterm is supposed to be a superset of vt220, in other words it's like vt220 but has more features. For example, xterm usually supports colors, but vt220 doesn't. You can test this by pressing z inside top.

In the same way, vt220 has more features than vt100. For example, vt100 doesn't seem to support F11 and F12.

Compare their features and escape sequences that your system thinks they have by running infocmp <term type 1> <term type 2>, e.g. infocmp vt100 vt220.

The full list varies from system to system. You should be able to get the list using toe, toe /usr/share/terminfo, or find ${TERMINFO:-/usr/share/terminfo}. If none of those work, you could also look at ncurses' terminfo.src, which is where most distributions get the data from these days.

But unless your terminal looks like this or this, there's only a few others you might want to use:

  • xterm-color - if you're on an older system and colors don't work
  • putty, konsole, Eterm, rxvt, gnome, etc. - if you're running an XTerm emulator and some of the function keys, Backspace, Delete, Home, and End don't work properly
  • screen - if running inside GNU screen (or tmux)
  • linux - when logging in via a Linux console (e.g. Ctrl+Alt+F1)
  • dumb - when everything is broken
5
  • 1
    Is that the full list of terminal type? Thank you~
    – sam
    Jul 25, 2012 at 16:28
  • 9
    @sam No, this isn't the full list. These are common ones. Anyone can invent a new terminal type, in principle. You can see what terminal types are available on your system by running ls /lib/terminfo/* /usr/share/terminfo/* (these are the paths on Debian, other distributions may have slightly different paths). Most of them are highly exotic. Jul 25, 2012 at 23:10
  • 2
    for a explanation of the codes have a look at: docs.intersystems.com/ens20152/csp/docbook/… Apr 7, 2016 at 9:38
  • 1
    vt220 supports colours! I had one with orange on black! ;-) Sorry.
    – Kusalananda
    Nov 7, 2018 at 11:23
  • @Kusalananda The first one having colors was vt241... All the vt220 you can find are white, green or orange, depending on the phosphors used...
    – ingroxd
    Jan 5, 2019 at 22:39
11

Run infocmp wihtout any argument will give you all available xterm alternatives:

$> infocmp
xterm|xterm-debian|X11 terminal emulator,
    am, bce, km, mc5i, mir, msgr, npc, xenl,
    colors#8, cols#80, it#8, lines#24, pairs#64,
    ...

For more info check

$> ls /lib/terminfo/x/
xterm         xterm-256color  xterm-color     xterm-debian    xterm-mono
xterm-r5      xterm-r6        xterm-vt220     xterm-xfree86
3
  • Did Mac OS have the terminfo directory?
    – zx1986
    Apr 9, 2016 at 16:11
  • 8
    this answer is not right. running infocmp without argument gives you the settings for the active terminal. to list the other terminals you use toe
    – Zombo
    Jan 1, 2018 at 14:17
  • 2
    @zx1986 there is /usr/share/terminfo directory on a macOS.
    – Mr. Tao
    Nov 4, 2018 at 22:04
0

echo $TERM:

Inside tmux: gives screen-256color

Outside: gives xterm-256color

Some keys, such as Home and End behave differently.

Type cat then press some keys to see the difference between different $TERM.


infocmp xterm-256color screen-256color | less

Many NULL under screen-256color

    comparing xterm-256color to screen-256color.
        comparing booleans.
        bce: T:F.
        ccc: T:F.
        mc5i: T:F.
        npc: T:F.
        comparing numbers.
        comparing strings.
        acsc: '``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~', '++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~'.
        clear: '\E[H\E[2J', '\E[H\E[J'.
        cnorm: '\E[?12l\E[?25h', '\E[34h\E[?25h'.
        cuu1: '\E[A', '\EM'.
        cvvis: '\E[?12;25h', '\E[34l'.
        ech: '\E[%p1%dX', NULL.
        enacs: NULL, '\E(B\E)0'.
        flash: '\E[?5h$<100/>\E[?5l', '\Eg'.
        initc: '\E]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\', NULL.
        invis: '\E[8m', NULL.
        is2: '\E[!p\E[?3;4l\E[4l\E>', '\E)0'.
        kDC: '\E[3;2~', NULL.
        kEND: '\E[1;2F', NULL.
        kHOM: '\E[1;2H', NULL.
        kIC: '\E[2;2~', NULL.
        kLFT: '\E[1;2D', NULL.
        kNXT: '\E[6;2~', NULL.
        kPRV: '\E[5;2~', NULL.
        kRIT: '\E[1;2C', NULL.
        ka1: '\EOw', NULL.
        ka3: '\EOy', NULL.
        kb2: '\EOu', NULL.
        kbeg: '\EOE', NULL.
        kc1: '\EOq', NULL.
        kc3: '\EOs', NULL.
        kend: '\EOF', '\E[4~'.
        kent: '\EOM', NULL.
        kf13: '\E[1;2P', NULL.
        kf14: '\E[1;2Q', NULL.
        kf15: '\E[1;2R', NULL.
        kf16: '\E[1;2S', NULL.
        kf17: '\E[15;2~', NULL.
        kf18: '\E[17;2~', NULL.
        kf19: '\E[18;2~', NULL.
        kf20: '\E[19;2~', NULL.
        kf21: '\E[20;2~', NULL.
        kf22: '\E[21;2~', NULL.
        kf23: '\E[23;2~', NULL.
        kf24: '\E[24;2~', NULL.
        kf25: '\E[1;5P', NULL.
        kf26: '\E[1;5Q', NULL.


-1

Back in the old days, "terminals" were separate devices. Some were paper and ink ribbon, some were "glass keypunches". There were many manufacturers. In addition to the text, the manufacturers wanted non-text (invisible) ways of invoking terminal-specific behavior, thus, "control characters" and "escape sequences". Since there was no standard, different manufacturers could choose different escape sequences for the same function (on their own terminals). Rather than setting each escape sequence (on this terminal, Here's how to clear screen, here's how to position the cursor, etc), setting the TERM environment variable acts as a key into a terminal info database, holding all the settings for that terminal. See man terminfo terminfos tput stty.

Digital Equipment Corporation (DEC) manufactured a popular glass keypunch, the VT100, followed by the VT220, whose control sequences were adopted by the Unix community.

"Control characters" (which differ from "characters" by having their. 7th bit (0x40) cleared, see man ascii) were inherited from the still earlier TypeType (a complex electro-mechanical marvel manufactured by The Phone Company (back when there was just one)) that was used for text transmission.

You, running a "terminal emulator", in a graphics canvas, in a window, on a screen, can only confuse the terminal emulator by futzing with TERM. TERM is used to make "mostly compatible", serially connected, different hardware machines "work" with Unix.

The history of serial communication is fascinating, as its reflection in Unix/Linux device interfacing If it works, keep it. If a "better" way comes along, use it. There's always someone, somewhere using a 110 baud Model 33 TeleType.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.