Cooking with Linux - Tricked-Out Terminals

Command-line users get some GUI toys with these windows that save screen space, add backgrounds and even start multiple terminals with one command.

Please, François, do not cry. What is making you so sad? The restaurant looks fantastic, mon ami. Everything is ready. What could possibly be so bad? Quoi? You were reading the menu and saw that we would be featuring terminal programs and that made you sad? Ah, Mon Dieu François, terminal programs have nothing to do with death; they are windows to the shell, much like the GNOME terminal, xterm or the KDE Konsole.

Our guests are arriving, François. Welcome, everyone, to Chez Marcel, where fine Linux fare meets fine wine. Please sit and make yourselves comfortable. François, please go to the wine cellar and bring back the 1999 Côte du Rhône. Vite!

While putting together the menu for this Systems Administration-themed issue, I was somewhat torn. There are, after all, so many different aspects to this topic. Then, I asked myself what systems administration tool I use most and came up with an interesting answer—it's a command shell run inside some kind of terminal emulator. Although this may seem extremely basic, the terminal program has come a long way since the days of the venerable xterm.

For those of you too young to remember, we call them terminal programs or emulators as opposed to shell windows, because they were software desktop equivalents of the terminals that at one time were connected physically to the mainframe system. But I digress, and François has returned with the wine.

I've used quite a number of terminal programs over the years. Originally, it was a plain xterm, still available on most Linux systems. Dressing it up meant changing the font color or background but not much else. For instance, to start a plain xterm with a steel blue background and red text, I would do the following:

xterm -background "SteelBlue" -foreground "Red"

In time, I discovered another terminal program called rxvt that also should be included on most systems. It gave me a little more control over configuration options. It not only looked better than my old xterm, but I could assign an XPM bitmap image for a background, which made it look pretty cool at the time:

rxvt -pixmap /usr/share/themes/BrushedMetal/gtk/bg.xpm -fg black

Then came the first terminal emulator I really fell in love with, one I still enjoy today. It's called Eterm, and although it was designed as an xterm replacement for the Enlightenment window manager, it should work with whatever you have, be it GNOME, XFCE, KDE or anything else. Check your distribution CDs for this one, as it may not be installed already on your system. You also can get the latest Eterm from the Eterm Web site (see the on-line Resources).

Besides looking great, Eterm offers some cool features. For example, Eterm can have a variety of background images, and in fact, it comes with several. Some of these are tiled pixmaps, and others are full background images (Figure 1). Simply click Background on the Eterm menu bar, then Pixmap and select from the tiled or scaled pixmaps available.

Figure 1. Eterm does transparency, backgrounds, themes and more.

You also can change the font size, brightness, contrast, scrollbar style and much more. You even can create and customize your own menu. If you are happy with the settings you have modified, click Eterm on the menu bar and select Save User Settings.

Eterm is themeable as well. Click the Themes link on the Eterm Web site, and you will see several themes that can be downloaded and installed on your system. These all are tarred and gzipped bundles. To install them, create a .Eterm directory in your $HOME directory and then create a themes directory below that. All you have to do now is extract the theme into that directory and it becomes available. To start your next Eterm with the appropriate theme, name it on the command line like this:

Eterm -t theme_name

One of my favorite features of Eterm, however, is the ability to make it transparent. I find this particularly nice because it lets me keep an eye on system logs as they scroll across my desktop and my current favorite wallpaper. All you have to do is click Background on the menu bar and select Toggle Transparency. This option doesn't work on KDE, but it does work on GNOME, WindowMaker and others. To view the Apache logs on my Web server on my transparent Eterm, I would run the following command:

Eterm -O -e sudo tail -f /var/log/httpd/access_log

This doesn't have anything to do with terminal emulators per se, but in the above example, you may need to add yourself to the /etc/sudoers file in order for this to work, unless, of course, you run the Eterm as root. In my case, I added a line in the file right below the definitions for root's privileges:

# User privilege specification
root    ALL=(ALL) ALL
marcel  ALL=(ALL) ALL

These days, there's another feature in terminal programs that has me excited, and that's tabs. There is no need to open three or four terminal applications, which can take up a fair amount of real estate. Take a look at the KDE Konsole program, for instance, or the GNOME terminal. Both provide not only basic shell access, but they also allow you to run multiple shells in tabbed sessions. To use tabs on your GNOME terminal, press Shift-Ctrl-T and you are presented with a new session (Figure 2).

Figure 2. A GNOME terminal with tabs saves screen real estate.

The GNOME terminal also supports transparency, so if I want to start up a script that lets my logs scroll across my wallpaper du jour, I can do that as well. With the GNOME terminal, this is done with profiles. To create a profile, click Edit on the GNOME terminal menu bar and select Profiles. Click New and give your profile a name, for example, seethrough. When the Editing Profile dialog appears, click on the Effects tab and click the Transparent background radio button (Figure 3).

Figure 3. To create a transparent GNOME terminal, you first need to create a profile.

Use the slider to adjust the level of transparency and then close the profile dialog. Now, start the GNOME terminal like this:

gnome-terminal --window-with-profile=seethrough \
-e "sudo tail -f /var/log/messages"

If you like the results, use that command in a shell script in order to call it by a name that makes sense to you.

In the KDE world, there's Konsole, which also handles tabs nicely. To start a tabbed Konsole session, click Session on the menu bar and select New Shell. Then, customize the tabs by double-clicking on them and giving them a name. When you are running multiple shells—a compile here, a monitor session there and a root shell in yet another tab—naming your tabs makes a lot of sense. Also notice that when you click the Session menu, several options are available, including starting a session in a bookmarked location (Figure 4).

Figure 4. The amazing Konsole—tabs, bookmarks and more!

Bookmarks? As you do your job as administrator, you find yourself going to the same directories over and over again. Sure, you can type quickly and get where you want to go, but Konsole extends its capabilities by letting you assign bookmarks. When you are in that familiar directory seven levels deep, simply click Bookmarks on the menu bar and then select Add Bookmark. You can assign a name to the location you want, and open a shell in that location with a single click.

And, of course, I can't move on without mentioning transparency. To enable transparency in Konsole, click Settings on the menu bar, then Schema and select one of the Konsole transparencies from there. While you are in the Settings menu, you see a ton of configuration options for the Konsole terminal program. Change the font, go to full-screen mode and change the encoding, change the keyboard layout or set an alarm to inform you when changes take place in one of your tabbed sessions. You can explore the Konsole features on your own, but I will leave you with a nice script to start a clean, transparent Konsole to track your log file:


konsole --schema Transparent.schema --nomenubar \
  --notabbar --noframe \
  -e sudo tail -f /var/log/messages

The final selection on tonight's menu is something so great, I'm frankly amazed I hadn't seen anything like it before. I decided it was great, because I started using it regularly as soon as I discovered it. Using KDE kparts, Simon Perreault created a program called Quadkonsole. As the name implies, it starts up four Konsole programs in a grid (Figure 5). There's no need to line up your Konsoles side by side or click from one shell tab to the next. To make things even nicer, the Quadkonsole creates only one task in the task bar, leaving your Kicker panel uncluttered. That feature is going to be particularly useful as I tell you more about this great terminal program.

Figure 5. Quadkonsole starts up four Konsoles in a perfect grid.

Each running Konsole can be modified at will by right-clicking on it, choosing Settings and then selecting the changes you are interested in making from the menu. For instance, you may want one to be transparent, another white on black with smaller fonts and so on. After all, each one is a Konsole and can be modified accordingly.

If you are feeling particularly distracted, you can tell Quadkonsole to start with more than four Konsoles. Simply specify the number of rows and columns, as follows:

quadkonsole --rows 4 --columns 4

This command starts up Quadkonsole with 16 individual terminal sessions (Figure 6). That's why having only one instance in your Kicker panel is such a nice feature. This also might be a good time to start playing with the font size if you want the information to fit. In one of my sessions, I have top, the real-time process and resource monitor, running with a super-tiny font. Of course, now I need to run a desktop magnifier such as kmag in order to see it.

Figure 6. When too much information is just right, Quadkonsole answers the call.

By default, the focus follows the mouse pointer, so if you happen to nudge the mouse accidentally while typing, strange and wonderful things may occur. To override that default, use the --clickfocus command option to start your Quadkonsole program. After doing so, you have to click in each window in order to select a particular Konsole.

I happen to prefer the click-to-focus option, but I don't always like having to reach for the mouse each time. Luckily, Quadkonsole has that covered as well. You can navigate from one Konsole instance to another by using the Shift-Ctrl-arrow key combination. This allows you to move up, down, left or right from one session to another.

Incroyable! It would seem, mes amis, that closing time has once again arrived. If only someone would write an application that could transform our one instance of leisure time into four or 16. Too much wonderful wine to savor, too many programs to explore and certainly not enough time. Do not worry, mes amis, I am more than willing to spend a little more time, and François would be happy to refill your glasses while you chat. Sit back and enjoy that Côte du Rhône. Raise your glasses, mes amis, and let us all drink to one another's health. A votre santsanté Bon appétit!

Resources for this article: /article/8259.

Marcel Gagné is an award-winning writer living in Mississauga, Ontario. He is the author of Moving to the Linux Business Desktop (ISBN 0-131-42192-1), his third book from Addison Wesley. He also makes regular television appearances as Call for Help's Linux guy. Marcel also is a pilot, was a Top-40 disc jockey, writes science fiction and fantasy and folds a mean Origami T-Rex. He can be reached by e-mail at mggagne@salmar.com. You can discover a lot of other things (including great Wine links) from his Web site at www.marcelgagne.com.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Terminator allows multiple

Anonymous's picture

Terminator allows multiple panes in Gnome Terminal, tabs then hide/show them all.

Since you seem to like Tabs

Eldorel's picture

Since you seem to like Tabs so much, I think you'll enjoy this little known feature of Eterm.

A Screen compatible theme!

Eterm -t Escreen

Yep, it basically uses some really neat features to tie into screen, allowing you to use Eterm as a frontend.
You get all of the advantages of screen, and the pretty themes of Eterm.

clarification

Eldorel's picture

Just checked my shortcut, turns out that i use

Eterm -U "/" to start a session

and Eterm -U "/-x" to resume

(i use 2 or 3 terms all looking into the same session, makes moving things around really easy)

Warning, if your hardstatus line has time and date on it set in your screenrc, you might have problems with the hardstatus in Eterm. (at least on ubuntu, and a few others i've used)

RXVT + Tabs + unicode = Mrxvt (previously called materm)

markstinson's picture

Marcel, nice introductary article to Tabbed terminals. I've always enjoyed KTerm for that very reason. But I'm surprised you didn't find or mention Mrxvt (previously called materm). Since you appear to prefer using Rxvt like I do, you should give Mrxvt a try, found at http://materm.sourceforge.net

  • It has all the eye candy and creature comforts you need, want and more - all while using standard X11 headers when compiling - no dependency on Gnome, KDE, etc. if you don't want it.
  • It compiles very easily, even under cygwin !! Compile it as lean or heavy as you want. Don't forget to `strip` it to make it even smaller.
  • Offers Unicode for Chinese.
  • You can send terminal ESC sequences to control the tabs and create new ones. ("input broadcasting for all tabs"). For example, I've aliased "newtab" so open another tab without leaving the keyboard.
  • Recognizes Ctrl+Tab to switch between tabs
  • It has been actively developed for almost a year. The current release is version 0.4.1 on 2005/05/02

Since finding mrxvt, I don't use KTerm or any other tabbed terminal. I think you'll enjoy mrxvt as much as I do. I wish I was more up to date in C programming (and had more time) to help out. I think this is very worthwhile project - particularly for smaller, leaner linux systems and distros like DSL.

mrxvt does not support

Anonymous's picture

mrxvt does not support unicode, unfortunately.

However, I just found out that urxvt has basic tab support through a perl module.
Command:
urxvt -pe tabbed
Xresource:
URxvt.perl-ext-common: default,tabbed

too bad, i was looking to

Anonymous's picture

too bad, i was looking to trick out the real shell, i know theres something for it, every live distro is using it but i dunno what the hell it is called

Your looking for...

jastreich's picture

It's all framebuffer magic and what you want to find is stuff like
fbsplash, fblogo, fbi and fbcon

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix