Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to content

Virtual console: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
→‎Interface: Mention of Systemd.
RDSEED (talk | contribs)
m clarification
 
(27 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{Short description|Computer user interface}}
{{for|Nintendo's game download service|Virtual Console}}
{{for|Nintendo's game download service|Virtual Console}}
{{also|Virtual terminal}}
{{ref improve|date=May 2014}}

[[Image:KNOPPIX booting.png|thumb|Virtual console showing [[Knoppix]] boot messages]]
[[Image:KNOPPIX booting.png|thumb|Virtual console showing [[Knoppix]] boot messages]]


A '''virtual console''' ('''VC''') – also known as a '''virtual terminal''' ('''VT''') – is a conceptual combination of the keyboard and display for a computer [[user interface]]. It is a feature of some [[operating system]]s such as [[BSD]], [[Linux]], and [[UnixWare]] in which the [[system console]] of the computer can be used to switch between multiple virtual consoles to access unrelated user interfaces. Virtual consoles date back at least to [[Xenix]] in the 1980s.<ref>{{cite web
A '''virtual console''' ('''VC''') – also known as a '''virtual terminal''' ('''VT''') – is a conceptual combination of the keyboard and display for a computer [[user interface]]. It is a feature of some [[Unix-like]] [[operating system]]s such as [[Linux]], [[BSD]], [[illumos]], [[UnixWare]], and [[macOS]] in which the [[system console]] of the computer can be used to switch between multiple virtual consoles to access unrelated user interfaces. Virtual consoles date back at least to [[Xenix]]<ref>{{cite web
|url=http://www.freepatentsonline.com/4945468.html
| url = http://www.freepatentsonline.com/4945468.html
|title=Trusted path mechanism for virtual terminal environments
| title = Trusted path mechanism for virtual terminal environments
|publisher= FreePatentsOnline.com
| publisher = FreePatentsOnline.com
| access-date = 2008-04-09}}<br />United States Patent 4945468 lists Xenix as prior art in this area.</ref> and [[Concurrent CP/M]] in the 1980s.<ref name="guzaitis198311">{{cite news
|accessdate=2008-04-09
| url = https://archive.org/stream/byte-magazine-1983-11/1983_11_BYTE_08-11_Inside_the_IBM_PC#page/n263/mode/2up
}}<br>United States Patent 4945468 lists Xenix as prior art in this area.</ref>
| title = Concurrent CP/M
| work = BYTE
| date = November 1983
| access-date = 19 March 2016
| last = Guzaitis
| first = Joe
| pages = 257–268}}</ref>


Usually in Linux (see [[Linux console]]), 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.
In the [[Linux console]] and other platforms, usually the first six virtual consoles provide a [[text terminal]] with a [[login prompt]] to a [[Unix shell]]. The graphical [[X Window System]] traditionally starts in the seventh virtual console (tty7), although this is configuration dependent.
In Linux, the user switches between them with the key combination ''[[Alt key|Alt]]'' plus a [[function key]] – for example ''Alt+[[Function key|F1]]'' to access the virtual console number 1. ''Alt+Left arrow'' changes to the previous virtual console and ''Alt+Right arrow'' to the next virtual console. To switch from the X Window System, ''Ctrl+Alt+function key'' works. (Note that users can redefine these default key combinations.)
In Linux, the user switches between them by pressing the [[Alt key]] combined with a [[function key]] – for example {{key press|Alt}} + {{key press|F1}} to access the virtual console number 1. {{key press|Alt}} + {{key press|Left}} changes to the previous virtual console and {{key press|Alt}} + {{key press|Right}} to the next virtual console. To switch from the X Window System or a [[Wayland_(display_server_protocol)#Wayland compositors|Wayland compositor]], {{key press|Ctrl}} + {{key press|Alt}} + {{key press|F1}} works. (Note that users can redefine these default key combinations.)


The need for virtual consoles has lessened now that most applications work in the graphical framework of the X Window System, where each program has a window and the text mode programs can be run in [[terminal emulator|terminal-emulator]] windows. If several [[Login session|sessions]] of the X Window System are required to run in parallel, such as in the case of [[fast user switching]] or when debugging X programs on a separate [[X.Org Server|X server]], each X session usually runs in a separate virtual console. [[GNU Screen]] is a program that can change between several text-mode programs in one textual login.
If several [[Login session|sessions]] of the X Window System are required to run in parallel, such as in the case of [[fast user switching]] or when debugging X programs on a separate [[X.Org Server|X server]], each X session usually runs in a separate virtual console.


==Implementation details==
== Interface ==
{{See|Terminal emulator#Implementation details}}
The virtual consoles are represented by [[device special file]]s /dev/tty1, /dev/tty2, etc. There are also special files /dev/console, /dev/tty and /dev/tty0. (Compare the devices using the patterns vcs ("virtual console screen") and vcsa ("virtual console screen with attributes") such as <code>/dev/vcs1</code> and <code>/dev/vcsa1</code>.<ref>
{{cite web
|url= http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-20.html
|title= Screen dumps
|accessdate= 2008-07-31
|author=
|last=
|first=
|authorlink=
|coauthors=
|date=
|year=
|month=
|work= The Linux keyboard and console HOWTO
|publisher= The [[Linux Documentation Project]]
|quote= The current contents of the screen of /dev/ttyN can be accessed using the device /dev/vcsN (where `vcs' stands for `virtual console screen'). [...] From a program it is usually better to use /dev/vcsaN (`virtual console screen with attributes') instead - it starts with a header giving the number of rows and columns and the location of the cursor. See vcs(4).
}}
</ref>
) The virtual consoles can be configured in the file /etc/inittab read by ''[[init]]'' -- typically it starts the text mode [[Logging (computer security)|login]] process ''[[getty (Unix)|getty]]'' for several virtual consoles. [[X Window System]] can be configured in /etc/inittab or by an [[X display manager (program type)|X display manager]]. Modern [[Linux]] distributions such as Fedora use [[Systemd]] instead. This still allows management of the ttys though.

Programs used to access the virtual consoles typically include:

* ''chvt'' to switch the current virtual console
* ''openvt'' to run a program on a new virtual console
* ''deallocvt'' to close a currently unused virtual console.

The program ''[[startx]]'' starts the [[X Window System]] on a new virtual console. There are also other graphical programs that can start from the console, such as [[LinuxTV]] and [[MPlayer]].

Programs can access the virtual consoles by the device special files. In text mode, writing to the file displays text on the virtual console and reading from the file returns text the user writes to the virtual console. As with other [[text terminal]]s, there are also special [[escape sequence]]s, [[control character]]s and <code>termios</code> [[system call|function]]s that a program can use, most easily via a library such as ''[[ncurses]]''. For more complex operations, the programs can use console and terminal special ''[[ioctl]]'' system calls. Graphical programs can use libraries such as [[DirectFB]], [[Direct Rendering Infrastructure|DRI]], [[Simple DirectMedia Layer|SDL]] or the earlier [[SVGALib]].

== Unix systems ==


==Unix systems==
Unix [[workstation]]s, such as those manufactured by [[Sun Microsystems|Sun]] or [[Silicon Graphics]], did not include virtual consoles. The only purpose of a console would be to fix the system so that the graphical environment could start.
Unix [[workstation]]s, such as those manufactured by [[Sun Microsystems|Sun]] or [[Silicon Graphics]], did not include virtual consoles. The only purpose of a console would be to fix the system so that the graphical environment could start.


Sun [[UltraSPARC T1|Niagara-based]] servers running [[Platform virtualization|virtualization]] with [[Logical Domains]] get virtual console services from the ''Control domain''.
Sun [[UltraSPARC T1|Niagara-based]] servers running [[Platform virtualization|virtualization]] with [[Logical Domains]] get virtual console services from the ''Control domain''.


== See also ==
==See also==
* [[Virtual desktop]], works similar to a virtual console, but operates on [[desktop metaphor|graphical desktops]] instead of a command prompt

* [[System console|Computer console]] for the concrete console
* [[System console]] for the non-virtual console
* [[Text terminal]] for the textual interface in general
* [[Text terminal]] for the textual interface in general
* [[Pseudo terminal]] for even more virtual consoles
* [[Pseudo terminal]] for even more virtual consoles
* [[Terminal emulator]] for an application program that has the same function as a textual virtual console
* [[Terminal emulator]] for an application program that has the same function as a textual virtual console


== Notes ==
==Notes==
{{reflist}}
{{Reflist}}


== References ==
==References==
* FreeBSD Handbook, chapter [http://www.freebsd.org/doc/en/books/handbook/consoles.html 3.2 Virtual Consoles and Terminals]
* FreeBSD Handbook, chapter [https://www.freebsd.org/doc/en/books/handbook/consoles.html 3.2 Virtual Consoles and Terminals]


== External links ==
==External links==
* [http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html The Linux keyboard and console HOWTO]
* [https://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html The Linux keyboard and console HOWTO]
* [http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=c/chvt Linux command chvt to switch vt from cmdline]
* [http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=c/chvt Linux command chvt to switch vt from cmdline]
* [http://www.softpanorama.org/People/Torvalds/Finland_period/xenix_microsoft_shortlived_love_affair_with_unix.shtml XENIX -- Microsoft's Short-lived Love Affair with Unix]
* [http://www.softpanorama.org/People/Torvalds/Finland_period/xenix_microsoft_shortlived_love_affair_with_unix.shtml XENIX -- Microsoft's Short-lived Love Affair with Unix]

Latest revision as of 01:47, 10 April 2022

Virtual console showing Knoppix boot messages

A virtual console (VC) – also known as a virtual terminal (VT) – is a conceptual combination of the keyboard and display for a computer user interface. It is a feature of some Unix-like operating systems such as Linux, BSD, illumos, UnixWare, and macOS in which the system console of the computer can be used to switch between multiple virtual consoles to access unrelated user interfaces. Virtual consoles date back at least to Xenix[1] and Concurrent CP/M in the 1980s.[2]

In the Linux console and other platforms, usually the first six virtual consoles provide a text terminal with a login prompt to a Unix shell. The graphical X Window System traditionally starts in the seventh virtual console (tty7), although this is configuration dependent. In Linux, the user switches between them by pressing the Alt key combined with a function key – for example Alt + F1 to access the virtual console number 1. Alt + changes to the previous virtual console and Alt + to the next virtual console. To switch from the X Window System or a Wayland compositor, Ctrl + Alt + F1 works. (Note that users can redefine these default key combinations.)

If several sessions of the X Window System are required to run in parallel, such as in the case of fast user switching or when debugging X programs on a separate X server, each X session usually runs in a separate virtual console.

Implementation details[edit]

Unix systems[edit]

Unix workstations, such as those manufactured by Sun or Silicon Graphics, did not include virtual consoles. The only purpose of a console would be to fix the system so that the graphical environment could start.

Sun Niagara-based servers running virtualization with Logical Domains get virtual console services from the Control domain.

See also[edit]

Notes[edit]

  1. ^ "Trusted path mechanism for virtual terminal environments". FreePatentsOnline.com. Retrieved 2008-04-09.
    United States Patent 4945468 lists Xenix as prior art in this area.
  2. ^ Guzaitis, Joe (November 1983). "Concurrent CP/M". BYTE. pp. 257–268. Retrieved 19 March 2016.

References[edit]

External links[edit]