Terminal emulator

From Gentoo Wiki
Jump to:navigation Jump to:search

A terminal emulator, terminal application, or term, (sometimes also referred to as a tty) emulates a video terminal within another display architecture (e.g. in X). This usually takes the form of a window in which the user can enter commands and view output, or of a fullscreen virtual console. A terminal emulator will generally start the shell that is defined as the login shell for a given user. On Gentoo, the default shell is bash.

After booting, Gentoo will show either a login prompt on a virtual console, by default, or a display manager if one has been set up. See next section about virtual consoles and how to switch between them.

If an X environment has been set up, there are many terminal emulator options available for the user to choose from - see software section.

Virtual consoles and switching

A virtual console (VC), aka virtual terminal (VT), allows for full-screen text-based interaction, via facilities provided directly by the kernel. Gentoo starts with six virtual consoles by default (this can be configured in inittab or with openrc-init). X can be started in a virtual console from the shell, or from a display manager, in which case X is traditionally shown on virtual console number 7. Keyboard shortcuts are used to switch between VCs, and the chvt command exists if needed.

From a text virtual console, it is possible to access the other VCs by pressing the Alt+F1 through Alt+F6 keys on the keyboard. The super key ("Windows" key on some keyboards, other times the Command or "Apple" key) will toggle consoles. To switch to the next or previous VC in numerical order, press Alt+ or Alt+.

From an X session, the Linux virtual consoles can be accessed with Ctrl+Alt+F1 through Ctrl+Alt+F6.

If an X session was started from a session manager on virtual console number 7, return to it by pressing Ctrl+Alt+F7, otherwise return to a graphical X session by going back to the virtual console on which it was started.

Available software

Popular terminal emulators include:

Title Package Description
Alacritty x11-terms/alacritty GPU-accelerated terminal emulator.
Kitty x11-terms/kitty A modern, hackable, featureful, OpenGL-based terminal emulator written in Python and C.
Konsole kde-apps/konsole The default terminal emulator for KDE / Plasma.
GNOME Terminal x11-terms/gnome-terminal The default terminal emulator for GNOME.
Guake x11-terms/guake Drop-down terminal emulator for GNOME.
lxterminal lxde-base/lxterminal The standard terminal emulator of LXDE.
rxvt-unicode x11-terms/rxvt-unicode Light in resource usage, fast, and more feature-rich (tabs, transparency, Unicode, etc.).
st x11-terms/st Simple terminal implementation for X.
Terminator x11-terms/terminator A terminal emulator arranging multiple terminals in one window, Python based, for GNOME.
terminology x11-terms/terminology The default terminal emulator for Enlightenment.
tilda x11-terms/tilda A drop down terminal, similar to the consoles found in first person shooters.
xfce4-terminal x11-terms/xfce4-terminal The default terminal emulator for the Xfce desktop environment.
XTerm x11-terms/xterm The default terminal emulator for X.org.
Yakuake kde-apps/yakuake Quake-style (drop-down) terminal emulator based on Konsole for KDE / Plasma.

Additional terminal emulators can be found in the x11-terms category.

General usage

Interrupt application

In many applications, pressing Ctrl+c will abort the application immediately by sending the SIGINT signal. See Wikipedia article.

Jobs

In many applications, pressing Ctrl+z will suspend the process, and return to the shell while continuing the process in the background. This may be useful for example, for running a command in a shell while in text editor. In many shells, the fg command will return to the suspended task, and jobs will list current background jobs.

In many shells, postpending a command with the "&" symbol will start a command directly in the background.

See Wikipedia on Ctrl+z, Wikipedia on job control, Bash docs, fish docs, and zsh docs.

Troubleshooting

Garbled display

Some actions can leave a terminal in a state unadapted to the normal display of text. For example, if binary information is output to the terminal (say with cat, or less), some of the data can be interpreted as control characters and modify the terminal's state. Another example would be a program dying and leaving the terminal in an abnormal state.

The problem can usually be fixed by typing the reset command.

Some shells can be cleared and redrawn by pressing ctrl+l (lower case L). Pressing ctrl+c a few times can, in cases, help somewhat. Another option is to use the "stty sane" and "tput rs1" commands.

The file command can be used to determine a file's type, to try to avoid outputting binary to a terminal in the first place. The od command or a hex editor can be useful to view binary files.

See also

External resources