Power TerminalsOver the course of our many lessons and adventures, we have learned a lot about the shell, and explored many of the common command line utilities found on Linux systems. There is, however, one program we have overlooked, and it may be among the most important and most frequently used of them all-- our terminal emulator. In this adventure, we are going to dig into these essential tools and look at a few of the different terminal programs and the many interesting things we can do with them. A Typical Modern TerminalGraphical desktop environments like GNOME, KDE, LXDE, Unity, etc. all include terminal emulators as standard equipment. We can think of this as a safety feature because, if the desktop environment suffers from some lack of functionality (and they all do), we can still access the shell and actually get stuff done. Modern terminal emulators are quite flexible and can be configured in many ways: ![]() gnome-terminal preferences dialog SizeTerminal emulators display a window that can be adjusted to any size from the sublime to the ridiculous. Many terminals allow configuration of a default size. The "normal" size for a terminal is 80 columns by 24 rows. These dimensions were inherited from the size of common hardware terminals, which, in turn, were influenced by the format of IBM punch cards (80 columns by 12 rows). Some applications expect 80 by 24 to be the minimum size, and will not display properly when the size is smaller. Making the terminal larger, on the other hand, is preferable in most situations, particularly when it comes to terminal height. 80 columns is a good width for reading text, but having additional height provides us with more context when working at the command line. Another common width is 132 columns, derived from the width of wide fan-fold computer paper. Though this is too wide for comfortable reading of straight text (for example, a man page), it's fine for other purposes, such as viewing log files. The 80-column default width has implications for the shell scripts and other text-based programs we write. We should format our printed output to fit within the limits of an 80-character line for best effect. TabsA single terminal window with the ability to contain several different shell sessions is a valuable feature found in most modern terminal emulators. This is accomplished through the use of tabs. ![]() gnome-terminal with tabs Tabs are a fairly recent addition to terminal emulators, first appearing around 2003 in both GNOME's ProfilesAnother feature found in several modern terminals is multiple configuration profiles. With this feature, we can have separate configurations for different tasks. For example, if we are responsible for maintaining a remote server, we might have a separate profile for the terminal that we use to manage it. Fonts, Colors, BackgroundsMost terminal emulators allow us to select fonts, colors, and backgrounds for our terminal sessions. The three most important criteria for selecting fonts, colors, and backgrounds are: 1. legibility, 2. legibility, and 3. legibility. Many people post screen shots of their Linux desktops online, and there is a great fascination with "stylish" fonts, faint colors, and pseudo-transparent terminal windows, but we use our terminals for very serious things, so we should treat our terminals very seriously, too. No one wants to make a mistake while administering a system because they mis-read something on the screen. Choose wisely. Past FavoritesWhen the first graphical environments began appearing for Unix in the mid-1980s, terminal emulators were among the first applications that were developed. After all, the GUIs of the time had very little functionality and people still needed to do their work. Besides, the graphical desktop allowed users to display multiple terminal windows- a powerful advantage at the time. xtermThe granddaddy of all graphical terminals is ![]() xterm with default configuration In its default configuration,
then we get a terminal like this: ![]() Configured xterm A complete list of the Xresources configuration values for While Though
Even if we are using a modern terminal, such as rxvtBy the standards of the time,
![]() urxvt with default configuration Like
Modern Power TerminalsMost modern graphical desktop environments include a terminal emulator program. Some are more feature-rich than others. Let's look at some of the most powerful and popular ones. gnome-terminalThe default terminal application for GNOME and its derivatives such as Ubuntu's Unity is TabsBusy terminal users will often find themselves working in multiple terminal sessions at once. It may be to perform operations on several machines at the same time, or to manage a complex set of tasks on a single system. This problem can be addressed either by opening multiple terminal windows, or by having multiple tabs in a single window. The File menu in Keyboard shortcutsSince, in an ideal universe, we never lift our fingers from the keyboard, we need ways of controlling our terminal without resorting to a mouse. Fortunately,
Keyboard shortcuts are also user configurable. While it is well known that ProfilesProfiles are one of the great, unsung features of many terminal programs. This may be because their advantages are perhaps not intuitively obvious. Profiles are particularly useful when we want to visually distinguish one terminal session from another. This is especially true when managing multiple machines. In this case, having a different background color for the remote system's session may help us avoid typing a command into the wrong session. We can even incorporate a default command (like Let's make a profile for a root shell. First, we'll go to the File menu and select "New Profile..." and when the dialog appears enter the name "root" as our new profile: ![]() gnome-terminal new profile dialog Next, we'll configure our new profile and choose the font and default size of the terminal window. Then we will choose a command for the terminal window when it is opened. To create a root shell, we can use the command ![]() Setting the command in the configuration dialog Finally, we'll select some colors. How about white text on a dark red background? That should convey an appropriate sense of gravity when we use a root shell. ![]() Setting the colors in configuration dialog Once we finish our configuration, we can test our shell: ![]() Root profile gnome-terminal We can configure terminal profiles for any command line program we want: Midnight Commander, Here is another example. We will create a simple man page viewer. With this terminal profile, we can have a dedicated terminal window to only display man pages. To do this, we first need to write a short script to prompt the user for the name of which command to look up, and display the man page in a (nearly) endless loop:
We'll save this file in our Next, we create a new terminal profile and name it "man page". Since we are designing a window for man pages, we can play with the window size and color. We'll set the window tall and a little narrow (for easier reading) and set the colors to green text on a black background for that retro terminal feeling: ![]() Man page gnome-terminal window Opening hyperlinks and email addressesOne of the neat tricks ![]() gnome-terminal URL context menu Resetting the terminalSometimes, despite our best efforts, we do something dumb at the terminal, like attempting to display a non-text file. When this happens, the terminal emulator will dutifully interpret the random bytes as control codes and we'll notice that the terminal screen fills with garbage and nothing works anymore. To escape this situation, we must reset the terminal. konsole
Bookmarks
![]() konsole bookmarks menu Split View![]() konsole's split view feature
![]() konsole with tabs and split view guake
Though
After saving this script, we can open new tabs in As we can see, For KDE users, there is a similar program called terminatorLike ![]() terminator with split screens By right-clicking in the ![]() The terminator menu Once split, each terminal pane can dragged and dropped. Panes can also be resized with either the mouse or a keyboard shortcut. Another nice feature of The preferences dialog supports many of the same configuration features as that of ![]() The terminator preferences dialog A good way to use ![]() Full screen terminator window with multiple panes We can even automate this by going into Preferences/Layouts and storing our full screen layout (let's call it "2x2") then, by invoking terminator this way:
to get our layout instantly. Terminals for other platformsAndroidWhile we might not think of an Android phone or tablet as a Linux computer, it actually is, and we can get terminal apps for it which are useful for administering remote systems. ConnectbotConnectbot is a secure shell client for Android. With it, we can log into any system running an SSH server. To the remote system, Connectbot looks like a terminal using the GNU Screen terminal type. One problem with using a terminal emulator on Android is the limitations of the native Google keyboard. It does not have all the keys required to make full use of a terminal session. Fortunately, there are alternate keyboards that we can use on Android. A really good one is Hacker's Keyboard by Klaus Weidner. It supports all the normal keys, ![]() Connectbot with Hacker's Keyboard on Android TermuxThe Termux app for Android is unexpectedly amazing. It goes beyond being merely an SSH client; it provides a full shell environment on Android without having to root the device. After installation, there is a minimal base system with a shell ( ![]() Termux displaying builtin shell commands We can have dot files (like When executing Chrome/Chrome OSGoogle makes a decent SSH client for Chrome and Chrome OS (which is Linux, too, after all) that allows logging on to remote systems. Called Secure Shell, it uses hterm (HTML Terminal, a terminal emulator written in JavaScript) combined with an SSH client. To remote systems, it looks like a "xterm-256color" terminal. It works pretty well, but lacks some features that advanced SSH users may need. Secure Shell is available at the Chrome Web Store. ![]() Secure Shell running on Chrome OS Summing UpGiven that our terminal emulators are among our most vital tools, they should command more of our attention. There are many different terminal programs with potentially interesting and helpful features, many of which, most users rarely, if ever, use. This is a shame since many of these features are truly useful to the busy command line user. We have looked at a few of the ways these features can be applied to our daily routine, but there are certainly many more. Further Reading
xterm:
Tektronix 4014:
rxvt:
urxvt (rxvt-Unicode):
gnome-terminal:
konsole:
guake:
terminator:
Connectbot:
Hacker's Keyboard:
Termux:
Secure Shell
|
|||||||||||||||||||||||||||||
© 2000-2019, William E. Shotts, Jr. Verbatim copying and distribution of this entire article is permitted in any medium, provided this copyright notice is preserved. Linux® is a registered trademark of Linus Torvalds. |