Byobu: Behind the folding screen

Multiplex

Article from Issue 175/2015
Author(s):

The Byobu window manager and terminal multiplexer lets you open multiple screens to compartmentalize tasks performed at the command line and helps keep track of the status of your systems.

Byobu [1] is a hybrid utility. On one hand, it provides a practical setup for those who need to work from more than one command prompt at a time. On the other hand, it provides a wealth of basic system information in abbreviated form. With this double benefit, Byobu solves two problems with screen space at the same time.

Originally conceived at the 2008 Ubuntu Developer Summit, Byobu is intended primarily for administrators who need to view multiple servers. In addition to providing multiple prompts within the same window, Byobu also displays two customizable status lines for monitoring systems. The program runs as a text-based window manager on top of either tmux [2] or GNU Screen [3], two earlier multiplexers, making it usable without a desktop (Figure 1). The name comes from the Japanese word for a folding screen, a metaphor whose origin becomes obvious the first time you see Byobu in use.

Figure 1: Byobu running with three separate prompts on top of tmux (note title bar).

Basic Orientation

Byobu is available from the repositories of major distributions. It starts with the command byobu, which includes no options of its own. You might configure it to run the options of either tmux or GNU screen, but most of these options are either obsolete on a modern system – on which, for example, you can usually take UTF-8 character support for granted – or conflict with Byobu's own configuration settings.

Instead of command options, Byobu uses a cluster of commands with similar names. In particular, if you want Byobu to run at each text login, use the command byobu-enable (Figure 2). If Byobu is already is enabled, you disable it with byobu-disable or suppress it for remote sessions with:

ssh -T REMOTEHOST bash
Figure 2: Toggling Byobu to run at a text login.

Along the bottom of the screen are two status lines. The Ubuntu documentation [4] refers to the top status line as the Caption and the bottom as Hard Stats, although these terms are not used in the Byobu man page or anywhere on the interface. Whatever you call the status lines, the top line lists multiple prompts – called windows – on the left, numbering them by default, as well as such information as the username and hostname. By contrast, the bottom line shows symbols and abbreviations that give information about the local machine, such as the operating system, uptime, and cores.

You can hide the bottom status line by running byobu-quiet and hide both lines with byobu-silent. Adding the option --undo to either of these commands reverses the command, toggling the hidden status lines.

You manipulate Byobu's windows (multiple prompts) entirely with keystrokes. The basic commands are shown in Table 1; for a complete list of key-based commands, see the Ubuntu community help [4] or press F9 and select the Quick Start Guide.

Table 1

Working with Byobu Windows

Keystroke

Action

F3

Go to the previous window

F4

Go to the next window

F5

Refresh status notifications

Shift-F6

Display window separately

F8

Rename current window in status line

Alt-Pageup

Scroll through window's history

Alt-Pagedown

Scroll forward through this window's history

Shift-F2

Split current window horizontally

Ctrl-F2

Split current window vertically

Shift-F3

Close all windows, leaving one

Ctrl-F5

Reconnect SSH/GPG sockets or agents

Collections of windows in Byobu are called screens. You can save screens with the command byobu-layout save [NAME]. To open a layout at any time, including when starting Byobu, use byobu-layout restore [NAME].

Configuring Status Lines

Byobu began as a collection of status indicators. Its multiplexing quickly became just as important, but the status lines are still in use, mainly because you can customize Byobu's status lines with 39 different status indicators. Obviously, you cannot use as many as half of the indicators before they become illegible, so choose the ones you prefer or need. Even then, memorizing colors and other elements of the indicators will make using them easier.

To edit, press F9 to get the Configuration Menu (Figure 3), select Toggle status notifications, and choose the desired indicators from the list (Figure 4). Table 2 shows the available indicators, but refer to the Byobu manual [5] for full details, especially about indicators that have custom settings.

Figure 3: Byobu Configuration Menu.
Figure 4: Choose from among 39 status indicators.

Table 2

Status Notifications

Option

Description

Color and Location

Lower Status Bar

apport

A pending crash report is available.

To the left, black on orange.

arch

System architecture

To the left, default colors.

battery

Battery power

On the right, green, yellow, and red indicate battery state.

cpu_temp

CPU temperature

Toward the right, yellow on black.

cpu_count

The number of CPUs or cores on the system

Displayed in default colors toward the right.

cpu_freq

CPU frequency

Toward the right, white on blue.

custom

User-defined custom scripts

Default colors unless indicated in script.

date

Date in YYYY-MM-DD format

Far right in the default colors.

disk

Total disk space available and total used on root directory

Displayed on far right, white on purple.

disk_io

Instantaneous read/write throughput in kBps or MBps over the last three seconds

Displayed toward the right, white on purple in white.

distro

Distribution

Black on gray.

ec2_cost

Estimation of the cost of the current system boot using Amazon EC2 billing model

Toward the right, green on black.

entropy

System's current entropy in bytes

Toward the right, yellow on dark gray.

fan_speed

CPU or system fan speed

Toward the right, black on gray.

load_average

System load average over the last one minute

Toward the right, black on yellow.

logo

Current operating system's logo

Far left.

mail

System mail for current user

Toward the left, black on gray.

memory

Percentage of memory available and used

Toward the right, white on green.

menu

Indicates menu

Far right.

network

Upload/download bandwidth over last three seconds

Toward the left, white text on purple.

notify_osd

Send on-screen notification messages to screen's notification buffer

processes

Number of processes running on system

White text on dark yellow.

raid

Blinks at RAID failure

Red on white.

rcs_cost

Cost of the current boot of the system in terms of the Rackspace Cloud Server billing model

Toward the right, green on black.

reboot_required

Whether rebooted needed after system update

White on blue.

release

Name of distro's current release

Black on gray.

services

User-defined list of services to monitor users can configure a list of services to monitor

Toward the center, cyan on white,

session

Byobu session name (with tmux only)

On the left, underlined black on white.

swap

Swap space used

Toward the right, white on light green.

time

Time in HH:MM:SS format

On the far right, default colors.

time_binary

Time in binary (GNU Screen)

Far right, default colors background colors.

time_utc

The UTC system time in HH:MM format

Far right, dark text on a light background.

updates_available

Number of updates available

Toward the right, white on red.

uptime

System uptime

Toward the right, blue on gray.

users

Number of remote users logged in via sshd

Toward the right, red on gray.

wifi_quality

Connection rate and signal quality of WiFi connection

Toward the right, black on cyan.

Top Status Bar*

hostname

Hostname

Far right, black on gray.

ip_address

IPv4 address of the system in dotted decimal form

Far right, black on gray.

ip_address6

IPv6 address of the system

Far right, black text on gray background.

whoami

Current user

Far right, black on gray.

*Note: The far left of the status bar is reserved for windows (prompts), with the current window highlighted in gray.

Many indicators have set colors and approximate positions on the status bars defined. Other settings used by indicators are detected automatically or defined in the file ~/.byobu/statusrc (Figure 5), or, occasionally, another file under ~/.byobu, and can be altered in a text editor.

Figure 5: The general Byobu configuration file, statusrc.

Similarly, to edit the background color of the status line, edit ~/.byobu/color when running Byobu with GNU Screen or ~/color.tmux when running Byobu with tmux. Colors are defined in hexademical web format. The key combination Ctrl+Shift+F5 changes the background to a randomly selected color when Byobu uses tmux. To return to the default colors, delete the file in which the color is set.

Ordinarily, Byobu defaults to using tmux, using GNU Screen only if tmux is not installed. However, you can edit its configuration to use GNU Screen, either with the command byobu-select-backend, or by editing directly the line BYOBU_BACKEND=tmux in the file ~/.byobu/backend. Use the back-end file if you want to run either tmux or GNU Screen with options, although every option for the two commands may not be relevant in a modern system or have any noticeable effect

Multiplexers or Status-Seekers

In my experience, users of Byobu fall into two categories: those who want multiple prompts, and those who want a quick system summary. Both groups benefit from as large a monitor as possible because after a few divisions into more than a few prompts, the screens quickly become too small to be useful. Similarly, those who want information need as wide a screen as possible to squeeze as many indicators onto the status lines while keeping each legible.

That point aside, Byobu is an elegant program, similar to Gnome tools in the simplicity of its multiplexing, yet similar to KDE in the completeness of its status indicators. It combines the best of both design philosophies, guaranteeing its usefulness.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Byobu

    The Byobu session manager extends the shell, adding a range of useful functions, such as splitting the screen, running programs in the background, or organizing programs in tabs. In particular, administrators who rely on SSH will appreciate Byobu.

  • Multi-Tasking

    Operate multiple terminal sessions in a single window.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News