Back before the days of graphical desktops, the only way to interact with a Unix system was through a text command line interface (CLI) provided by the shell. The CLI allowed text input only, and could only display text and rudimentary graphics output.
Because of this restriction, output devices did not have to be very fancy. Often a simple dumb terminal was all that was required to interact with the Unix system. A dumb terminal was usually nothing more than a monitor and keyboard (although later on in life they started getting fancier by utilizing a mouse) connected to the Unix system via a communication cable (usually a multi-wire serial cable). This simple combination provided an easy way to enter text data into the Unix system and view text results.
As you well know, things are significantly different in today’s Linux environment. Just about every Linux distribution uses some type of graphical desktop environment. However, to access the shell you still need a text display to interact with a CLI. The problem now is getting to one. With all of the new graphical Linux desktop features, sometimes finding a way to get a CLI in a Linux distribution is not an easy task.
One way to get to a CLI is to take the Linux system out of graphical desktop mode and place it in text mode. This provides nothing more than a simple shell CLI on the monitor, just like the days before graphical desktops. This mode is called the Linux console, since it emulates the old days of a hard-wired console terminal, and is a direct interface to the Linux system.
The alternative to being in the Linux console is to use a terminal emulation package from within the graphical Linux desktop environment. A terminal emulation package simulates working on a dumb terminal, all within a graphical window on the desktop. Figure below shows an example of a terminal emulator running in a graphical Linux desktop environment.
Each terminal emulation package has the ability to emulate one or more specific types of dumb terminal. If you’re going to work with the shell in Linux, unfortunately you’ll need to know a little bit about terminal emulation.
Knowing the core features of the old dumb terminals will help you decide which emulation type to select when you’re using a graphical terminal emulator, and use all of the available features to their full capabilities. The main features used in the dumb terminal can be broken down into two areas: the graphics capabilities and the keyboard. This section describes these features and discusses how they relate to the different types of terminal emulators.
The most important part of terminal emulation is how it displays information on the monitor. When you hear the phrase ‘‘text mode,’’ the last thing you’d think to worry about is graphics. However, even the most rudimentary dumb terminals supported some method of screen manipulation (such as clearing the screen and displaying text at a specific location on the screen).
This section describes the graphics features that make each of the different terminal types unique, and what to look for in the terminal emulation packages.
All terminals must display characters on the screen (otherwise, text mode would be pretty useless). The trick is in what characters to display, and what codes the Linux system needs to send to display them. A character set is a set of binary commands that the Linux system sends to a monitor to display characters. There are several character sets that are supported by various terminal emulation packages:
ASCII The American Standard Code for Information Interchange. This character set contains the English characters stored using a 7-bit code, and consists of 128 English letters (both upper and lower case), numbers, and special symbols. This character set was adopted by the American National Standards Institute (ANSI) as US-ASCII. You will often see it referred to in terminal emulators as the ANSI character set.
ISO-8859-1 (commonly called Latin-1) An extension of the ASCII character set developed by the International Organization for Standardization (ISO). It uses an 8-bit code to support the standard ASCII characters as well as special foreign language characters for most Western European languages. The Latin-1 character set is popular in multinational terminal emulation packages.
By far the most common character set in use today in English-speaking countries is the Latin-1 character set. The Unicode character set is becoming more popular, and may very well one day become the new standard in character sets. Most popular terminal emulators allow you to select which character set to use in the terminal emulation.
Besides being able to display characters, terminals must have the ability to control special features on the monitor and keyboard, such as the cursor location on the screen. They accomplish this using a system of control codes. A control code is a special code not used in the character set, which signals the terminal to perform a special, nonprintable operation.
Common control code functions are the carriage return (return the cursor to the beginning of the line), line feed (put the cursor on the next horizontal row), horizontal tab (shift the cursor over a preset number of spaces), arrow keys (up, down, left, and right), and the page up/page down keys. While these codes mainly emulate features that control where the cursor is placed on the monitor, there are also several other codes, such as clearing the entire screen, and even a bell ring (emulating the old typewriter end-of-carriage bell).
Control codes were also used in controlling the communication features of dumb terminals. Dumb terminals were connected to the computer system via some type of communication channel, often a serial communication cable. Sometimes data needed to be controlled on the communication channel, so developers devised special control codes just for data communication purposes. While these codes aren’t necessarily required in modern terminal emulators, most support these codes to maintain compatibility. The most common codes in this category are the XON and XOFF codes, which start and stop data transmission to the terminal, respectively.
Block mode graphics
As dumb terminals became more popular, manufacturers started experimenting with rudimentary graphics capabilities. By far the most popular type of ‘‘graphical’’ dumb terminal used in the Unix world was the DEC VT series of terminals. The turning point for dumb terminals came with the release of the DEC VT100 in 1978. The DEC VT100 terminal was the first terminal to support the complete ANSI character set, including block mode graphic characters.
The ANSI character set contains codes that not only allowed monitors to display text but also rudimentary graphics symbols, such as boxes, lines, and blocks. By far one of the most popular dumb terminals used in Unix operations during the 1980s was the VT102, an upgraded version of the VT100. Most terminal emulation programs emulate the operation of the VT102 display, supporting all of the ANSI codes for creating block mode graphics.
The Tektronix company produced a popular series of terminals that used a display method called vector graphics. Vector graphics deviated from the DEC method of block mode graphics by making all screen images (including characters) a series of line segments (vectors). The Tektronix 4010 terminal was the most popular graphical dumb terminal produced. Many terminal emulation packages still emulate its capabilities.
The 4010 terminal displays images by drawing a series of vectors using an electron beam, much like drawing with a pencil. Since vector graphics doesn’t use dots to create lines, it has the ability to draw geometric shapes using higher precision than most dot-oriented graphics terminals. This was a popular feature among mathematicians and scientists.
Terminal emulators use software to emulate the vector graphics drawing capabilities of the Tektronix 4010 terminals. This is still a popular feature for people who need precise graphical drawings, or those who still run applications that used the vector graphics routines to draw complicated charts and diagrams.
A key to graphics displays is the ability of the terminal to buffer data. Buffering data requires having additional internal memory within the terminal itself to store characters not currently being displayed on the monitor.
The DEC VT series of terminals utilized two types of data buffering:
The first type of buffering is known as a scroll region. The scroll region is the amount of memory the terminal has that enables it to ‘‘remember’’ data as it scrolls off of the screen. A standard DEC VT102 terminal contained a viewing area for 25 lines of characters. As the terminal displays a new line of characters, the previous line is scrolled upward. When the terminal reaches the bottom line of the display, the next line causes the top line to scroll off the display.
The internal memory in the VT102 terminal allowed it to save the last 64 lines that had scrolled off of the display. Users had the ability to lock the current screen display and use arrow keys to scroll backward through the previous lines that had ‘‘scrolled off’’ of the display. Terminal emulation packages allow you to use either a side scrollbar or a mouse scroll button to scroll through the saved data without having to lock the display. Of course, for full emulation compatibility, most terminal emulation packages also allow you to lock the display and use arrow and page up/page down to scroll through the saved data.
The second type of buffering is known as an alternative screen. Normally, the terminal writes data directly to the normal display area on the monitor. A method was developed to crudely implement animation by using two screen areas to store data. Control codes were used to signal the terminal to write data to the alternative screen instead of the current display screen. That data was held in memory. Another control code would signal the terminal to switch the monitor display between the normal screen data and the data contained in the alternative screen almost instantaneously. By storing successive data pages in the alternative screen area, then displaying it, you could crudely simulate moving graphics.
Terminals that emulate the VT00 series of terminals have the ability to support the alternative screen method.
Even back in the black-and-white (or green) dumb terminal days, programmers were experimenting with different ways to present data. Most terminals supported special control codes to produce the following types of special text:
Back in the old days, if you wanted to get someone’s attention, you used bold, blinking, reverse video text. Now there’s something that could hurt your eyes!
As color terminals became available, programmers added special control codes to display text in various colors and shades. The ANSI character set includes control codes for specifying specific colors for both foreground text and the background color displayed on the monitor. Most terminal emulators support the ANSI color control codes.
There is more to a terminal than just how the monitor operates. If you have ever worked with different types of dumb terminals, I’m sure you have seen that they often contain different keys on the keyboard. Trying to emulate specific keys on a specific dumb terminal has proven to be a difficult task for terminal emulation packages.
It was impossible for the creators of the PC keyboard to include keys for every possible type of special key found in dumb terminals. Some PC manufacturers experimented with including special keys for special functions, but eventually the PC keyboard keys became somewhat standardized.
For a terminal emulation package to completely emulate a specific type of dumb terminal, it must remap any dumb terminal keys that don’t appear on the PC keyboard. This remapping feature can often become confusing, especially when different systems use different control codes for the same key.
Some common special keys you’ll see in terminal emulation packages are:
Keyboard emulation is a crucial element in a terminal emulation package. Unfortunately, often applications are written requiring users to hit specific keys for specific functions. I’ve seen many a communications package that used the old DEC PF1 through PF4 keys, which are often a hard thing to find on a terminal emulation keyboard.
Shell Scripting Related Interview Questions
|Perl Scripting Interview Questions||Python Interview Questions|
|Linux Interview Questions||Linux Embedded systems Interview Questions|
|AWK Interview Questions||BioPerl Interview Questions|
|Sed (Stream Editor) Interview Questions||Advanced Linux Interview Questions|
|Unix/Linux Interview Questions||Unix Shell Scripting Interview Questions|
Shell Scripting Tutorial
Starting With Linux Shells
Getting To The Shell
Basic Bash Shell Commands
More Bash Shell Commands
Using Linux Environment Variables
Basic Script Building
Understanding Linux File Permissions
Working With Editors
Using Structured Commands
More Structured Commands
Handling User Input
Adding Color To Scripts
Introducing Sed And Gawk
The Ash Shell
The Tcsh Shell
The Korn Shell
The Zsh Shell
Using The Web
Using A Database
Shell Script For Administrators
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.