August 23, 2012

Enhancing Virtual Terminals with Byobu

The Community Ubuntu Documentation describes Byobu as a "text-based window manager." The paradox is only apparent because, just as a window manager enhances an X session, Byobu enhances a virtual terminal, making it easy to open new tabs and adding a detailed status line.

Byobu was originally designed for Ubuntu but is now available for RPM distributions and other Unix-like systems. Running on top of GNU Screen or tmux -- the choice is yours -- the software takes its name from the comparison of its multiple tabs to the Japanese folding screens used as room dividers.

When installed, Byobu adds an item to the desktop menu. However, you can also start it by entering byobu as a command in any virtual console. The application runs most reliably in GNOME Terminal, but you can also run it from KDE Konsole or any other terminal emulator, although occasional hiccups can happen.byobu screen

Status Indicators, Splits and Windows

Byobu's most obvious feature is the status indicators that are shown along the bottom of the window. If running on top of GNU Screen, Byobu uses two status lines, the top for information about the current session, the bottom for hardware information. By contrast, when Byobu runs on tmux only a single line displays.

Either way, over three dozen status indicators are available, ranging from the current user, host and address to CPU temperature and processors. Notifications for pending crash reports, RAID failures, available package updates and any reboots required after system upgrades are also available. There is even provision for custom indicators.

The other major feature is tabs. Within the currently active session, you can add a split -- a new prompt within the same window -- by pressing Shift-F2 to split the space horizontally, or Ctrl-F2 to split the space vertically. Alternatively, F2 opens an entirely new window. With additional key bindings you can move between windows or splits in the same window, open and close them. Within each session you can also enter the scrollback history, and copy and paste text using only keystrokes.

Configuration Tools

The list of keyboard shortcuts is lengthy, so you should start your explorations of Byobu by pressing F9 and viewing the help link in the configuration menu. Then select Toggle status notifications to choose the indicators to display at the bottom of the window. You can also use the configuration menu to change the escape sequence and set Byobu to launch at login.

However, Byobu is shifting away from the configuration menu in favor of a suite of utilities. The most useful of these is byobu-select-session, which allows you to set whether Byobu runs on top of of GNU Screen or the default tmux, an adjustment that may help if some features are unavailable under one configuration.

Another useful utility is byobu-status-detail, which gives a detailed report on what is happening with your system. Currently, at least some of these utilities are not officially documented, such as byobu-quiet, which suppresses the top status line, and byobu-silence, which suppresses both status lines, but you can use tab completion to see a list of all utilities.

Other settings are adjustable in the files in the ~/.byobu directory. For these files, you can consult those in /usr/share/byobu for detailed instructions. Using these files, you can change the basic colors in which Byobu displays or the positioning of indicators on the status lines.

Probably the most useful file is ~/.byobu/windows, which contains a list of local and remote windows to open, one entry per line, in the structure described in the screen man page. Otherwise, Byobu is persistent, opening with the windows that displayed the last time it ran.

Byobu could use more up-to-date documentation, and users can easily stumble across combinations of features that don't work together or even cause crashes. However, if you are the type of user likely to find Byobu useful, you might consider a few quirks a fair trade for the potential power.