Version 5

    element14's The Ben Heck Show

    Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics!

    Back to The Ben Heck Show homepage

    sudo Sergeant
    Featured Bonus Content
    See All Episodes



    Felix gives an introduction to virtual consoles, terminal emulators, and program shells. He traces terminal emulator to its historical antecedent; an early electromechanical device known as a teleprinter, teletypewriter console, or teletype; and discusses how the terminal program emulates the legacy hardware connected to the mainframe.



    A program shell is a system program for executing other programs, conducting administrative tasks, or to run scripts. It is sometimes referred to as a prompt, command line interface, console user interface, character user interface, command line/language interpreter, or interactive command line. The program shell is an interactive command interpreter intended as a scripting language and contains most of the features that are commonly considered to produce structured programs.


    When you hear the words terminal the first thing you probably imagine is a dark screen with a blinking cursor that is used to type instructions to direct a machine.  It wasn't always this way.  The terminal emulator is the modern evolution of an early electromechanical device known as a teleprinter, teletypewriter console, or teletype. A teletype printer is an electromechanical device, similar to a typewriter, used to send commands to a mainframe and receive output. A console and a terminal were essentially the same thing, however slightly different. The console was generally comparable in hardware terms to any other terminal except that a terminal connected directly to the mainframe and was intended for system maintenance. This entire process is now emulated by software.  As Linux evolved, the functionality of consoles has been built into the kernel as virtual consoles. Software has been written to emulate terminals. Its legacy can be found in the abbreviation tty, which is used to identify virtual consoles or to represent terminal connections.


    A terminal is a program that emulates the legacy physical hardware connected to a mainframe. It allows text input and produces text output. Just a few of the many examples of terminals include console, gnome terminal, LX terminal X term, and terminator. A console is essentially the same as terminal, however, in historical context, it was generally considered the point of interaction with a mainframe and was intended for system maintenance. In a modern system the virtual consoles serve a very similar role. The shell is a program that receives and interprets instructions. The shell can run independently of the terminal emulator, however, we will only be examining it in terms of its relation to the terminal emulator. There are numerous shells to choose from. There are quite a few examples of this including: Bourne Shell (SH), Bourne-Again Shell (BASH), C Shell (CSH), Korn Shell (KSH), and Remote Shell (RSH/IP). The prompt is the beginning line in a program shell which signifies start of input. The command line is the space to the right of the prompt where instructions and data are input. You’ll generally find your blinking cursor here.


    Felix demonstrates how to switch between different virtual consoles. From command line he types "W" which allows him to see which user is logged into which console. The screen shows that the only virtual console that’s active is tty1:


    On this particular machine there are six different virtual consoles that are setup.  To switch between them you simply hold down “ctrl alt” and then press either function key 1 through function key 6 sequentially.  To go from tty1 to tty2 simply hold down “ctrl alt” and function key 2.



    Hitting “control alt” and then function key 3 gives you tty3. After demonstrating this with all six virtual consoles he goes back to tty2 and logs into it. Felix goes back to tty3 and logs in as a different user.



    Next, Felix goes to Virtual Console 2 and instantiates another instance of the graphical environment. To do this he types startx and this gives him a whole new desktop that is completely different from the previous desktop.  Anything they do on the graphical environment that they’ve instantiated on virtual console 2 will be completely independent from anything they do on virtual console one.  A practical instance of this would be if someone wanted to set up a machine to do multiseat.  Multiseat is sort of like multihead except the difference is that there are multiple monitors connected to one computer but at each monitor there is also an addition of input devices like a keyboard and mouse. So there’s multiple keyboards and monitors, maybe even audio devices, all connected to one computer, and then it would essentially function as a mainframe did a long time ago.


    In the comments below tell us about your experience with teletypes or what you’ve done with virtual consoles!