Keyboards, Consoles, and VT Cruising
The first exception to note is that when the X Window System starts, it is displayed on the first unused tty—one that doesn't have a getty running on it. Since the first six ttys had gettys running on them, X would, in the example above, start on tty 7. Now we know the solution to the great riddle, “So where is X ?”, when you switch from X to a console. Pressing crtl-alt-f1 in X would switch you to VT 1. If you wanted to get back to X, simply:
press keypad_0 if you've mapped this to the Last_Console keysym.
press keypad_7 to switch to VT 7 on which X is running.
press alt-f7 to switch to VT 7.
The other exception to note is that while you can't run programs on a VT without logging in, you can still send output there. As a simple experiment try the following:
$ echo "This is a test" > /dev/tty7
Switching to VT 7, you'll see the words “This is a test” displayed. This ability becomes useful with system logging. Without going into an exhaustive discussion of system logging and configuration, it is worth noting that the output of all logging facilities can be “dumped” to an unused VT which allows quick perusal for events such as logins, kernel messages, mail logging, etc. To do this simply add the following line to the /etc/syslog.conf file (after logging in as root):
# this one will log ALL messages to the #/dev/tty9 terminal since this is an unused # terminal at the moment. This way, we # don't need to hang a getty on it or take up # a lot of system resources. *.* /dev/tty9
Once you've added this stanza to /etc/syslog.conf, you'll need to either kill and restart the syslog daemon or else send it the HUP (hang up) signal. Since this latter method is fairly easy let's do it:
$ ps -x | grep syslog 28 ? S 0:01 /usr/sbin/syslogd
will output the PID (process ID number) of the syslog daemon which in this case is 28. Now, just type in:
$ kill -HUP 28
in which 28 is the PID number. The syslog daemon will re-read its initialization files. From here on, all logging that occurs, regardless of its source, will be output to tty9 (or whichever tty device you specify).
Switching to VT 9 you might see something like the following:
Jul 1 10:11:37 FiskHaus kernel: Max size:342694 Log zone size:2048 Jul 1 10:11:38 FiskHaus kernel: First datazone:68 Root inode number 139264 Jul 1 10:11:38 FiskHaus kernel: ISO9660 Extensions: RRIP_1991A Jul 1 12:21:50 FiskHaus login: ROOT LOGIN ON tty2 Jul 1 17:26:56 FiskHaus login: 1 LOGIN FAILURE ON tty5, fiskjm
The first three lines represent kernel messages that occur when a CD is mounted. Root logins are noted by the login program as well as login failures—in this last case I purposely entered an incorrect password.
The value of all of this logging may not be immediately evident, but if you've ever noticed your machine thrashing about and swapping like crazy, or, while on-line, your hard drive lights begin to light up when you're not doing anything—a quick switch to VT 9 can often give you an idea about what's going on. These instructions should get you started. The manual pages for loadkeys, showkey and keytables have much more complete technical descriptions of key mapping. Also, the kbd package comes with a good deal of helpful documentation in its /doc subdirectory. And finally, don't forget the Keyboard-HOWTO which can be found among the growing number of Linux HOWTOs http://www.ssc.com/linux/howto.html).
John Fisk (email@example.com) After three years as a General Surgery resident and Research Fellow at the Vanderbilt University Medical Center, he decided to “hang up the stethoscope” and pursue a career in Medical Information Management. He's currently a full time student at the Middle Tennessee State University and working on a graduate degree in Computer Science before entering a Medical Informatics Fellowship. In his dwindling free time, he and his wife Faith enjoy hiking and camping in Tennessee's beautiful Great Smoky Mountains. An avid Linux fan since his first Slackware 2.0.0 installation a year and a half ago
Editorial Advisory Panel
Thank you to our 2014 Editorial Advisors!
- Jeff Parent
- Brad Baillio
- Nick Baronian
- Steve Case
- Chadalavada Kalyana
- Caleb Cullen
- Keir Davis
- Michael Eager
- Nick Faltys
- Dennis Frey
- Philip Jacob
- Jay Kruizenga
- Steve Marquez
- Dave McAllister
- Craig Oda
- Mike Roberts
- Chris Stark
- Patrick Swartz
- David Lynch
- Alicia Gibb
- Thomas Quinlan
- Carson McDonald
- Kristen Shoemaker
- Charnell Luchich
- James Walker
- Victor Gregorio
- Hari Boukis
- Brian Conner
- David Lane