Console Comfort


Get to know Terminator, a terminal emulator based on Gnome Terminal that lets you split windows, create groups of terminals, and more.

By Joe "Zonker" Brockmeier

If your workspace is cluttered with 10 open xterms at any given time and you want to tame the chaos and winnow down the number of windows so you can actually manage your work effectively, it's time to get acquainted with Terminator [1].

Why would you want Terminator instead of Gnome Terminal [2] or the venerable xterm [3]? Because in Terminator, you can manage multiple terminal sessions in one window. I don't mean just having multiple tabs with a single terminal session in each tab, I mean a single tab that hosts two, three, or more terminal sessions.

Terminator does this by splitting a window into multiple child windows that each hold a terminal session, which makes life much simpler if you need a bunch of terminal sessions running at the same time. For example, on my desktop I usually have a couple of sessions running Vim to write articles or edit configuration files. Usually, I also have one or more SSH sessions to my web server and other computers on my home network. And, I like to have a session or two open to run commands, read man pages, and so on. In short, I usually have between five and 20 terminal sessions going at one time.

Now, it is possible to manage that many sessions in separate tabs with Gnome Terminal, but what if you want to see two (or more) sessions side-by-side? That's where Terminator really starts to shine. As shown in Figure 1, Terminator handles multiple sessions in the same window and in separate tabs gracefully.

Figure 1: Running multiple sessions in Terminator.

Yes, you can do similar things with GNU Screen [4], but Terminator makes it much easier than Screen for sessions that you don't want to detach. Of course, nothing is stopping you from using Screen and Terminator together. To start, you have to get Terminator set up, though. Note that, for the purposes of this column, I'm looking at Terminator 0.93 from the Universe repository of Lucid Lynx. Older versions of Terminator might not have some of the features that I describe here, so make sure you're using the latest release!

Getting Terminator

If you're using recent releases of Ubuntu, you should have Terminator in the Universe repository. Just search for Terminator in the Software Center or use Apt to grab it:

apt-get install terminator

If you're using an older release of Ubuntu, but you want the most recent Terminator hotness, that's not a problem. By following the instructions from the Terminator website, you can add the gnome-terminator repository and install the most recent release:

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

If you're using Fedora, Terminator is also available in the repos, although (again) it's not installed by default. Some distros still don't package Terminator, but it's pretty easy to get working from source if you need to. Check the Terminator project site [1] for more information.

Note that you can even get Terminator up and running on Mac OS X if you so desire. It requires the Fink package, but otherwise, it is easy to set up.

Getting Started

Once you have Terminator installed, it's time to start managing your terminals. To begin, run Terminator from the system menu or run terminator from the command line. Without any preferences set and without passing any command-line options, Terminator will look a lot like Gnome Terminal. If you right-click in the Terminator window, you'll see a context menu, as shown in Figure 2.

Figure 2: Terminator's context menu.

From the context menu, you can split the current window horizontally or vertically and manage several of the Terminator settings directly. After splitting the window, you can rearrange the layout using the mouse or Terminator key bindings. Terminator would be chock-full of awesome if the only thing it could do was manage multiple terminals in one window, but there's more.

To focus on just one of the terminals, bring up the context menu and select Zoom Terminal. This will expand that child window to fill up the entire Terminator window. When you're ready to resume the other sessions, just use the context menu again and select Restore all Terminals.

Setting Preferences

Older releases of Terminator required setting preferences in a text configuration file or at the command line. Current releases, however, have a handy Preferences dialog that you can use to configure pretty much every aspect of Terminator. Note that you can still use the configuration file if you like working with text configs, but I'll stick with the Preferences dialog.

To get to Preferences, right-click on the Terminator window and select Preferences. You'll see a window with five tabs, as shown in Figure 3.

Figure 3: Terminator Preferences window.

As of v0.93, the Plugins tab is just a placeholder. Terminator doesn't have plugins yet, but that does give you something to look forward to! Starting with the Global tab, if you're a fan of the old school Unix mouse behavior, you can tell Terminator to Follow mouse pointer under Mouse focus. This will focus whichever Terminator window the mouse pointer is in at the time, rather than requiring you to click the window. Unix window systems used to work this way, although you'll find fewer fans of that type of mouse behavior today.

Also, you can change the color of the title bars in the window if you're not a fan of the red scheme (I'm not) or switch the Tab position. I prefer to set the tabs on the left-hand side of the window rather than up top.

The next tab is where a lot of the action is. The Profiles tab allows you to set the color for the Terminator window and font, choose the cursor shape, turn off the title bar, and generally control the look and feel of Terminator.

The Profiles tab has six tabs of its own. I mentioned previously that Terminator works with GNU Screen. If you're a fan of Screen, you can even set it to be the default shell when you launch Terminator by clicking the Command tab and the field that says Run a custom command instead of my shell, as shown in Figure 4. The path to Screen on Ubuntu is /usr/bin/screen. That should hold true for most distributions, but you can check for sure by running which screen.

Figure 4: Configuring Terminator to run Screen as the shell.

Although I won't walk through every configuration option, I want to point out the ability to save layouts. If your work habits are consistent, you might find yourself using the same general layout all the time. Rather than starting Terminator with a single window and then splitting it into multiple child windows every time, save a layout that fits your work habits. When you have Terminator just as you like it, right-click and select Preferences from the context menu. Select the Layouts tab and click Add. You should see something like Figure 5.

Figure 5: Configuring Terminator layout for future use.

If you look on the right-hand side of the dialog, you'll see that you have two options for each child window: You can set a different profile and even a custom command. For example, say you'd like to launch a Vim session in one window. Just add vim as a custom command. (Note that as of v0.93, setting GNU Screen as a custom command doesn't work. It will generate an error saying Aborted because of window size change.) Give the layout a name, like p1 or newprofile and close the dialog.

Now if you launch Terminator with terminator -l p1, you'll see your new layout without having to start from scratch. Terminator doesn't have a way to select layouts interactively at this time, except by launching with the -l option. Later releases will likely allow you to select this from the menu.

If you enjoy working with the configuration text file - or if you want to copy your existing preferences to another computer - you can find it at ~/.config/terminator/config. See the terminator_config man page for options and formatting for this file.

Terminator Key Bindings

You can plonk around in Terminator well enough with the mouse, but it also has a handy set of key bindings. In particular, I prefer to switch between child windows with the use of hotkeys rather than switching to the mouse. To cycle through windows clockwise, use Ctrl+Tab; use Ctrl+Shift+Tab to cycle counterclockwise.

Another nifty trick with Terminator is to search through the "scrollback" if you want to see command output that's scrolled out of the display. To search, use Ctrl+Shift+f. To close a child terminal, use Ctrl+Shift+w. If you want to see nothing but the Terminator window on your screen, hit F11, and it will make Terminator full screen. Hit F11 again to restore the window to its original size and position.

All of the Terminator key bindings are available in the Preferences dialog under the Keybindings tab. If you don't like the default key bindings, it's easy to change them. This isn't immediately obvious from the dialog itself, but if you click on the key binding option you want to change, it appears. Just click on the current key binding, and it will say New accelerator.... Then type the new hotkey you want, and you'll be all set.

Grouping Sessions

Here's a nifty trick for admins who have to run updates on two or more servers at the same time. Instead of logging into each server sequentially, try creating a group in Terminator.

In the upper left-hand corner of the main Terminator window, you'll see a small icon, as shown in Figure 6. When you click that, it will display a menu with several options for groups and for sending input to multiple sessions. For instance, if you have split the current window into two sessions, you can set both of them to receive the same input. Just create a new group and add both child windows to that group, and you can even add child windows in other tabs to the same group. If you need to stop sending the same input to all child windows, just use the menu and select Broadcast Off.

Figure 6: Creating groups in Terminator.

Terminal Problems Terminated

Although there's a bit more to Terminator, I've covered the broad strokes in this column. You should be able to install Terminator and configure it to your heart's content. So you don't have to customize Terminator on every computer you use, you can even back up your configuration or copy it to another computer.

Terminator has been around for a while, but development has really picked up recently. It's making great strides and has replaced the standard Gnome Terminal on my desktop. Give it a try, and you might want to make it your default as well.

INFO
[1] Terminator: http://www.tenshu.net/terminator/
[2] Gnome Terminal documentation: http://library.gnome.org/users/gnome-terminal/stable/gnome-terminal-introduction.html.en
[3] Xterm: http://invisible-island.net/xterm/
[4] GNU Screen: http://www.gnu.org/software/screen/