I’m a huge fan of screen and use it every day. Since I pretty much live in the terminal (using irssi for IRC and Mutt for email, as well as terminals for everything else from editing text files to doing various sysadmin-related things), I always look for ways to spruce up working in the terminal. Screen is a definite sanity-saver in that I can have one terminal window open and easily switch between different virtual consoles to accomplish different things.

Screen is nice enough, but it’s a little lackluster. That’s where Byobu comes in. Byobu is a wrapper for screen with a whole lot of cool functionality bundled with it. And the nice thing about Byobu is that it is indeed a wrapper for screen, meaning your existing ~/.screenrc will work, if you’ve customized it. Out of the box, without any configuration, Byobu will present you with an extra status bar than screen does, which shows your username and hostname, as well as your IP address. But this can all be easily configured by using the byobu-config tool below.

Figure A

You can also get to the byobu-config tool by using the menu command (the default is CTRL+A then @, inside a Byobu session). The nice thing here is the status notifications: you can have Byobu display real-time statistics of your computer, including things like battery life, CPU frequency, CPU temperature, the date, hostname, load average, uptime, and so forth.

All of this is also configurable outside of Byobu, by changing files in ~/.byobu/. For instance, to define the set of windows loaded by default, you would create ~/.byobu/windows with entries similar to the following:

screen -t Shell zsh
screen -t IRC irssi
screen -t Email mutt

Note that if you do have a ~/.screenrc defined with default screens, they will also be added. For instance, if ~/.screenrc contains:

screen -t shell1     0
screen -t shell2     1
select 0

Byobu will load those two shells as well. And any status information you have defined in ~/.screenrc will be shown also:

Figure B

Renaming or removing ~/.screenrc will have Byobu load without any pre-determined configurations that might clash with it. Of course, you can do something like the following to get the best of both worlds:

$ mv ~/.screenrc ~/.screenrc.org
$ alias screen="/usr/bin/screen -c ~/.screenrc.org"

Now when you run screen, you will still get your default screen settings, and when you run Byobu, the original screen settings won’t interfere.

Figure C

Finally, Byobu lets you define your own plugins which is really quite nice. This is done by creating executable scripts in ~/.byobu/bin/ where they are named in a specific way: N_NAME, where N is the number of seconds to refresh and NAME is the name of the script. For instance, you may want to know the number of Apache threads on a server, so you would create ~/.byobu/bin/10_apache containing:

num="$(ps ax|grep httpd|grep -v grep|wc -l)"
echo "httpd: ${num}"

Make the script executable and within seconds, a new status field will appear in the Byobu status bar.

Byobu is really quite slick and is a definite enhancement to screen. I really appreciate the custom plugins, which are really nice for quick alerts, a bonus to anyone who spends a lot of time in a terminal.