62

Terminal emulators The master side replaces the line (the pair of TX/RX wires) that goes to the terminal. The terminal displays the characters that it receives on one of the wires (some of those are control characters and make it do things like move the cursor, change colour...) and sends on another wire the characters corresponding to the keys you type. ...


50

What is $TERM for? The $TERM variable is for use by applications to take advantage of capabilities of that terminal. For example, if a program want's to display colored text, it must first find out if the terminal you're using supports colored text, and then if it does, how to do colored text. The way this works is that the system keeps a library of known ...


47

Most terminals can be launched using the geometry switch allowing you to specify terminal's size and position (COLUMNSxROWS+X+Y) e.g.: gnome-terminal --geometry 73x31+100+300 or xterm -geometry 93x31+100+350 If you want to make the above permanent, copy the terminal launcher (terminal's .desktop file) from /usr/share/applications/ to ~/.local/share/...


46

Filippo Valsorda has a solution for OS X that incorporates iTerm 2, tmux, and mosh. His solution uses a single window/tab to connect to a remote shell. The shell survives disconnects (e.g., connection failure, IP changes, laptop reboots) and supports scrollback with a touchpad, copy-paste, and colors. Caveats are that you must build mosh from source, ...


41

So there are a few open source fonts targeting programmers that support ligatures, namely FiraCode Hasklig Monoid Iosevka However, very few opensource terminals that run natively on Linux yet support this. But you can find an current list in the FiraCode docs Kitty I am using Kitty on i3 and I really love it Black Screen (slow in browser terminal emulator ...


32

When you “open a terminal”, you're starting a terminal emulator program, such as xterm, gnome-terminal, lxterm, konsole, … One of the first things the terminal emulator does is to allocate a pseudo terminal (often called a pseudo-tty, or pty for short). The pty is a pair of character device files: the pty master, which is the side that the terminal emulator ...


31

Originally you had just dumb terminals - at first actually teletypewriters (similar to an electric typewriter, but with a roll of paper) (hence /dev/tty - TeleTYpers), but later screen+keyboard-combos - which just sent a key-code to the computer and the computer sent back a command that wrote the letter on the terminal (i.e. the terminal was without local ...


31

Edit: Since this answer, I wrote a dedicated article on my blog, for people who would be interested on more details. After a lot of reading, this is what I understood. Has ptmx any purpose besides allocating the slave part? Does it provide some kind of "intelligence", or the emulated terminal (xterm for instance) has all the intelligence of behaving like ...


31

The following script will produce a test pattern like: You can optionally call it as: width=1000 truecolor-test and it will print a pattern of width columns. #!/bin/bash # Based on: https://gist.github.com/XVilka/8346728 awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{ s="/\\"; for (colnum = 0; colnum<term_cols; colnum++) { ...


28

The TERM environment variable indicates the terminal type, not the terminal application. TERM has a specific purpose: it tells applications running in that terminal how to interact with the terminal. Applications interact with terminals by writing escape sequences — sequences of characters that include nonprintable characters and have effects such as moving ...


23

I came across this one tool called ttylog. It's a Perl program available on CPAN here. It has a couple caveats, one being that I could only figure out how to attach to a terminal that was created as part of someone ssh'ing into my box. The other being that you have to run it with elevated privileges (i.e. root or sudo). But it works! For example First ssh ...


21

Indeed it is. The /dev/vcs* and /dev/vcsa* devices corresponds to the /dev/tty* devices (the virtual terminals). F1=tty1=vcs1/vcsa1 and so on. The vcs/vcsa is like tty for the "current" virtual terminal. As root, you can just cat these devices (e.g. cat /dev/vcs2), and see what's on the corresponding VT (e.g. /dev/tty2 the on on F2) like taking a ...


19

When some other program prints foo to the /dev/pts/9 the communication is between ttys, the shell doesn't participate in the exchange, it can not be aware of how many characters were printed or even if any character was printed. The shell is still believing that there are no characters to erase. In fact, if you print foo to the terminal and try to erase it ...


18

You may have inadvertently hit the VT320 escape sequence to hide the cursor. If so, then neither Ctrl+Q, nor reset, nor clear, nor Ctrl+L will help. What worked for me was to use the following command to send the VT320 "unhide" command sequence: echo -en "\e[?25h"


18

Look at: man 1 script For example: script -f /dev/tty1 Source


17

In Debian, that is x-terminal-emulator: sudo update-alternatives --config x-terminal-emulator Further reading: Debian Alternatives System Virtual Package: x-terminal-emulator Debian Policy Manual: Chapter 11 - Customized programs Debian Policy Manual: 11.8.3 Packages providing a terminal emulator


16

The terminal emulation is baked pretty deep into the design of mosh, so, no. Mosh works by having both client and server each maintain its local idea of what the screen currently "looks like", and that requires that the server does terminal emulation. This is how the client is able to refresh the contents of the screen after it has been away for a while and ...


15

When you press a key or key combination in a terminal, it is transmitted to the application running in the terminal as a sequence of one or more characters. For example, when you press a, the application receives a. When you press Enter, the application receives the character CR (a.k.a. ^M (pronounced “control-emm”), a.k.a. character number 13, a.k.a. \r or \...


15

The software you are looking for is called "cool-old-term" and is available on github. It emulates the look of a CRT and is based around konsole (KDE's terminal) and requires QT 5.2 or newer. The readme has instructions for getting it working on Ubuntu 14.04 and Arch. The examples on the github page show a few other variations on the CRT look and the ...


14

You can change your settings in Gnome Terminal keyboard settings to make Ctrl+C = Copy Ctrl+V = Paste Menu > Edit > Keyboard Shortcuts... Then you can still press Shift to do whatever that key combination would usually do in a terminal, e.g. Ctrl+Shift+C = Interrupt Ctrl+Shift+V = Literal Next Character Alternatively, you could get into the habit of ...


14

You can hold the Shift key to use the normal mouse selection while xterm mouse-tracking is enabled. That works in all terminal emulators that I know (xterm, vte (like xfce-terminal) or rxvt-based ones). In vim specifically, mouse is normally not enabled by default in terminals. So there's probably a set mouse=a somewhere in you ~/.vimrc or your OS-supplied ...


13

Here is a scheme I made some time ago about how sshd works. It doesn't concern the operation of line discipline and stuff, but it adds a real-life illustration of who interacts with what:


12

The environment variable TERM does not mean the terminal you are using. Quoting gnu.org: The environment variable TERM contains a identifier for the text window's capabilities. You can get a detailed list of these cababilities by using the > ‘infocmp’ command, using ‘man 5 terminfo’ as a reference. When producing text with embedded color ...


11

There is a perl script, 256colors2.pl, that will display all the colours on your terminal.


11

The process started by xterm will be the session leader in control of the terminal. When the terminal goes away, that process automatically receive a SIGHUP signal (followed by a SIGCONT). This is sent by the kernel in a similar way that processes receive SIGINT when you press CTRL-C. Additionally, a shell may send SIGHUP to some of its children upon ...


11

Perhaps your confusion arises from not having used an actual terminal. Back when serious computers were the size of several upright refrigerators, a terminal communicated with a central computer over a serial cable using characters and characters only. The characters were part of some standardized character set, e.g. ASCII or EBCDIC, but typically ASCII. ...


11

There are a few separate terms here that need to be independently defined: Terminal: A real keyboard/monitor interface, like the VT100: https://en.wikipedia.org/wiki/VT100 Terminal emulator(TTY): Emulates a terminal, providing input and output. Press ctrl+alt+F2 in most Linux distros, and you'll be in one. Type "w" in the terminal, and you'll see your w ...


11

The important part of the value of TERM is that it matches an entry in the terminfo or termcap databases, and that that entry correctly describes your terminal. You cannot reasonably go telling softwares that your terminal is XTerm, when it blatantly is not. And it is an outright error to think that other terminal emulators use all the same input/output ...


10

I don't think you can. xterm need not be installed everywhere, and indeed probably isn't by default. Especially when a desktop environment is in use that provides its own terminal. I think your best bet is probably to check for the existence of a few different terminals (say, xdg-terminal, x-terminal-emulator, gnome-terminal, konsole, xterm). And maybe work ...


10

There are eight standard ANSI colors, supported by every terminal emulator. Most terminal emulators also have eight bright variants of the standard ANSI colors. However, the actual color values that the escape codes map to aren't standardized, and in fact they often slightly vary among terminal emulators. So if you do printf "\e[31;47mTest\n" to print red ...


Only top voted, non community-wiki answers of a minimum length are eligible