Virtual console in linux

Linux console

The Linux console is a system console internal to the Linux kernel. The Linux console provides a way for the kernel and other processes to send text output to the user, and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor. The Linux kernel supports virtual consoles — consoles that are logically separate, but which access the same physical keyboard and display.

This article describes the basics of the Linux console and how to configure the font display. Keyboard configuration is described in the /Keyboard configuration subpage.

Contents

Implementation

This article or section needs expansion.

The console, unlike most services that interact directly with users, is implemented in the kernel. This contrasts with terminal emulation software, such as Xterm, which is implemented in user space as a normal application. The console has always been part of released Linux kernels, but has undergone changes in its history, most notably the transition to using the framebuffer and support for Unicode.

Despite many improvements in the console, its full backward compatibility with legacy hardware means it is limited compared to a graphical terminal emulator.

Virtual consoles

The console is presented to the user as a series of virtual consoles. These give the impression that several independent terminals are running concurrently; each virtual console can be logged in with different users, run its own shell and have its own font settings. The virtual consoles each use a device /dev/ttyX , and you can switch between them by pressing Alt+Fx (where x is equal to the virtual console number, beginning with 1). The device /dev/console is automatically mapped to the active virtual console.

Text mode

This article or section needs expansion.

Since Linux originally began as a kernel for PC hardware, the console was developed using standard IBM CGA/EGA/VGA graphics, which all PCs supported at the time. The graphics operated in VGA text mode, which provides a simple 80×25 character display with 16 colours. This legacy mode is similar to the capabilities of dedicated text terminals, such as the DEC VT100 series. It is still possible to boot in text mode if the system hardware supports it, but almost all modern distributions (including Arch Linux) use the framebuffer console instead.

Framebuffer console

As Linux was ported to other non-PC architectures, a better solution was required, since other architectures do not use VGA-compatible graphics adapters, and may not support text modes at all. The framebuffer console was implemented to provide a standard console across all platforms, and so presents the same VGA-style interface regardless of the underlying graphics hardware. As such, the Linux console is not a terminal emulator, but a terminal in its own right. It uses the terminal type linux , and is largely compatible with VT100.

Keyboard shortcuts

Keyboard Shortcut Description
Ctrl+Alt+Del Reboots the system (specified by the symlink /usr/lib/systemd/system/ctrl-alt-del.target )
Alt+F1 , F2 , F3 , . Switch to n-th virtual console
Alt+ ← Switch to previous virtual console
Alt+ → Switch to next virtual console
Scroll Lock When Scroll Lock is activated, input/output is locked
Ctrl+c Kills current task
Ctrl+d Inserts an EOF
Ctrl+z Pauses current Task
Читайте также:  Windows 10 oemcp 866

Fonts

This article or section needs expansion.

By default, the virtual console uses the kernel built-in font with a CP437 character set, [1] but this can be easily changed.

The Linux console uses UTF-8 encoding by default, but because the standard VGA-compatible framebuffer is used, a console font is limited to either a standard 256, or 512 glyphs. If the font has more than 256 glyphs, the number of colours is reduced from 16 to 8. In order to assign correct symbol to be displayed to the given Unicode value, a special translation map, often called unimap, is needed. Nowadays most of the console fonts have the unimap built-in; historically, it had to be loaded separately.

The kbd package provides tools to change virtual console font and font mapping. Available fonts are saved in the /usr/share/kbd/consolefonts/ directory, those ending with .psfu or .psfu.gz have a Unicode translation map built-in.

Keymaps, the connection between the key pressed and the character used by the computer, are found in the subdirectories of /usr/share/kbd/keymaps/ , see /Keyboard configuration for details.

Preview and temporary changes

shows a table of glyphs or letters of a font.

setfont temporarily change the font if passed a font name (in /usr/share/kbd/consolefonts/ ) such as

Font names are case-sensitive. With no parameter, setfont returns the console to the default font.

So to have a small 8×8 font, with that font installed like seen below, use e.g.:

To have a bigger font, the Terminus font ( terminus-font ) is available in many sizes, such as ter-132n which is large.

Источник

Linux / UNIX: Virtual consoles (VC)

Q. Can you explain the term Virtual Consoles and elaborate the usage of the same?

A. Under FreeBSD, Linux, or UNIX the virtual console (VC) allows a user to have multiple logins without using X windows GUI system. It is also known as virtual terminal (VT)

Linux has 6 VC

It is a combination of the keyboard and the display for a user interface. The concrete combination is the system console of the computer, where the user can switch between the virtual consoles to access multiple unrelated user interfaces. Usually in Linux, the first six virtual consoles provide a text terminal with a login prompt to a unix shell. The graphical X Window System starts in the seventh virtual console. To access 6 terminal press and hold [CTRL] + [ALT]+F<1,2,3,4,5,6>. For example press CTRL+Alt+F1 (or ALT+F1) to access the virtual console number 1.

Access X GUI system

To access X GUI system press CTRL+ALT+F7.

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Other options for VC/VT

GNU Screen is a program that can change between several text-mode programs in one textual login.

Читайте также:  Что делать если при переустановки windows выдает ошибку

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

Hey can you please guide me as to how i can access these Virtual terminals / Virtual Consoles in VMware, as i have the minimal install of Centos 6.0.

Brief description:
I installed Centos 6.0 Minimal Install and set a Static Ip for my eth0. So that i can access my Router Emulator in Virtual Machine in the Host machine . The issue i face is my Centos machine network interface will be up only when my modem is switched on , i.e pinging from Virtual machine to host happens upon modem being on otherwise it fails & i don’t know how to set Route between Virtual Machine to Host Machine without the default gateway ( my ISP modem ).

When i try to access these Virtual Consoles by holding the Ctrl+Alt [F1 to F6] so that i can telnet to different routers it doesn’t show up.

When my modem is Switched on i use putty to ssh and start routers one by one. Later i use SecureCRT to connect those routers in tab.

My host machine ip is set to : 192.168.1.5 /24
Virtual Machine is set to Bridge Mode with Staic Ip assigned to Centos: 192.168.1.14 /24.

[ It was many of the posts at http://www.cyberciti.biz that helped me setup the Cent O.S. ]

Yeah i found, my mistake.

It was Alt+ F1 through F6 & not Ctrl+Alt+F1.

Please help enabling Routing Between Virtual Machine Cento OS 6.0 & Host Windows 7. As explained earlier my Virtual Machine Centos is not able to Ping with Windows 7 & i need to know how to enable Routing between these.

My host machine ip is set to : 192.168.1.5 /24
Virtual Machine is set to Bridge Mode with Staic Ip assigned to Centos: 192.168.1.14 /24.
My default gateway is set to my Modem 192.168.1.1.

When i switch on my default gateway (modem) i can clearly see that communication is happening between VM (Cent O.S 6.0 ) to Modem (192.168.1.1) to Host (192.168.1.5). If Modem is down ping fails.

Источник

Чем отличаются понятия «виртуальная консоль» и «виртуальный терминал»?

Кто из этих двоих реализует обработку ANSI-последовательностей?
Если программа xterm реализует «виртуальный терминал», то кто тогда ей предоставляет консоль?

Что общего у консолей и udev ? Зачем создаются tty-устройства (это как-бы терминалы или всё-таки консоли?)

Как понять, используется ли у меня в системе http://en.wikipedia.org/wiki/Kmscon
(какой-нибудь lsmod + проверка в пакетном менеджере?)

Есть гипотеза, что терминал — текстовый, а консоль может быть любая, например графическая:

«Usually in Linux (see Linux console), the first six virtual consoles provide a text terminal, The graphical X Window System starts in the seventh virtual console.»

в этом смысле мне не ясно, в чем заключается «особонеобходимое умение работать в консоли»

Считай, что консоль — это терминал, реализуемый ядром. Правда, kmscon в это определение не вписывается, но его писали люди, не уважающие терминологию %)

A console is generally a terminal in the physical sense that is by some definition the primary terminal directly connected to a machine. The console appears to the operating system as a (kernel-implemented) terminals. On some systems, such as Linux and FreeBSD, the console appears as several terminals (ttys) (special key combinations switch between these terminals);

Более того, эти люди скоро сделают CONFIG_VT=n.

Ты случайно не про systemd-consoled?

вы меня все совсем запутали, хочу картинку-схему, что с чем и для чего соединяется

Кто из этих двоих реализует обработку ANSI-последовательностей?

Терминал. Виртуальная консоль лишь предоставляет эмулятору терминала I/O. Виртуальная консоль может быть как текстовая, так и во фреймбуфере. На работу терминала это не влияет.

это как-бы терминалы или всё-таки консоли?

Терминалы, которым соответствует инстанс консоли. Иксовые терминалы в /dev/pts (man 4 tty)

А где иксовые консоли? Те, в которые можно переключаться через Alt-Ctrl-F7, Alt-Ctrl-F8 и т.д.

Нет, это графические эиуляторы терминала (xterm, rxvt, konsole,etc) за них отвечает подсистема псевдотерминалов (PTY).

Сначала увидел, что VT не может в антиалиасинг, поржал. Потом сходил на about и все понял.

Во времена мейнфреймов были консоли. Это была такая железяка, которая совмещала в себе устройства ввода-вывода(читай монитор и клавиатуру) и подключалась к самому мейнфрейму. Этих консолей зачастую было много. Они могли быть текстовые или графические. Термнал — это программа, которая на консоли крутилась и общалась с мейнфреймом, а шелл — это программа, которая предоставляла командный интерфейс. В линуксах же есть виртуальные консоли т.к. написано по образу и подобию юникса. Они так-же могут быть графическими или текстовыми(для шелов и иксов соответственно). Иксовые терминалы — это приблуды для эмуляции текстовой консоли внутри графической. Ну а шеллы они и в африке шеллы. Как-то так. Вроде бы ничего не напутал.

Есть гипотеза, что терминал — текстовый, а консоль может быть любая, например графическая

Консоль — это железяка(может быть текстовая или графикеская), а терминал — это программа для связи консоли с мейнфреймом. А вот шелл — он только текстовый т.к. предоставляет командный интерфейс и работает только в виртуальных терминалах.

«Они (консоли) так-же могут быть графическими или текстовыми(для шелов и иксов соответственно).»

Команда chvt может переключить с текстовой консоли на графическую.
1) Как она это делает — через VT API или есть отдельный специальный API для консолей ?
2) как в /dev посмотреть сколько у меня графических консолей?

Консоль, по идее, вообще одна — это /dev/console, и chvt просто дергает /dev/console, посылая ему сообщение VT_ACTIVATE с номером нужного терминала в качестве параметра.

Источник

Читайте также:  Почему у меня много папок windows
Оцените статью