Byobu, a simple terminal multiplexer


I am not a proponent of highly customized development environments. During the years, I’ve tried employing various “advanced” tools and tricks in my workflow: zsh, all sorts of terminals, shortcuts, aliases, and so on. Most of them didn’t stick. In most cases, I’m not interested enough to change the ways and habits for something that is supposed to marginally improve my everyday work, doesn’t come by default, and requires extra configuration.

Still, among such tools, there are a few exceptions that seem to strike a balance between complexity and added value, and one of them is byobu.

In short, this is a terminal multiplexer with convenient keybindings and a smooth learning curve (as compared to tmux). It offers a flexible text-based UI for splitting your terminal into multiple panes and windows, and also keeps remote processes running even after you’ve been disconnected from an SSH session.

A complete, concise Byobu video tutorial with a beautiful musical accompaniment,
published on a project’s website.

The good

There are a few functions of Byobu I use regularly. They cover the majority of use-cases and are easy to learn:

  • Creating windows with F2 and closing them with Ctrl+F6. A window is equivalent to a regular terminal tab.
  • Creating splits with Ctrl+F2 and Shift+F2 (splits are closed just like windows, with Ctrl+F6).
  • Navigating among splits with Shift+Arrows and among windows with Alt+Left/Right.
  • Zooming in and out of the splits with Shift+F11. This is useful when I need to concentrate on specific process output or select text from a split with a mouse (more on that below).
  • Searching through a console history vim-like style with / (first you need to enter a scrollback mode with F7 or Alt+PageUp).

What else I like about Byobu:

  • A help screen with all the keybindings is available with Shift+F1. It serves as a quick reminder and is enough to learn the tool.
  • A decent mouse support. It is off by default, but is easily enabled with Alt+F12; then you can scroll, navigate and resize the splits with a mouse.
  • It offers an adequate set of opinionated defaults so that you can use most features that tmux or screen provide, while not being overwhelmed with their complexity. The implementation is abstracted so well that I don’t even have to know it runs tmux under the hood.

Also, it has some useful capabilities that I am yet to master:

  • Saving output history with Shift+F7 (might be good when dealing with a long output and tailing logs).
  • Saving and restoring split layouts. For now, I just recreate windows and splits as needed when I reboot a computer (which I don’t do often). Ideally, if I was to use this feature, I’d also want the tool to remember a working directory and a command each split has been running. I know some tmux extensions do that but haven’t tried using them.
  • Using multiple sessions. A session is another layer of abstraction over windows and splits, but so far working within a single session covers all my needs.
  • Customizable status bar with all kinds of extra information like hostname, CPU usage, and so on.

The inconvenient

Sure, no tool is perfect; but byobu is imperfect in understandable and tolerable ways. These are a few inconveniences I face when using it:

First, it is confusing to ssh from a local byobu session to a remote one. By default, all the keyboard shortcuts are captured by a local instance. To yield control to remote, local keybindings must be disabled with Shift+F12. There is no visual clue for which instance controls the keyboard at the moment. And I imagine ssh-ing even deeper to another layer of remote byobu adds even more confusion.

Then, selecting text with a mouse is clunky. When using splits, selecting text with a mouse selects everything across every split instead of the focused one. I am aware there are keybindings intended specifically for searching and selecting text in a split, but I just have a habit of using a mouse for that. My workaround is to zoom into a current split with Shift+F11, select a text, then zoom out with Shift+F11 again.

Finally, for some reason, it doesn’t autostart on one of my machines despite running byobu-enable. I am too lazy to figure this out, so I just execute byobu after reboot. This is not a big deal and is probably caused by a local misconfiguration.

Conclusion

Overall, Byobu is a great tool that extends the functionality of a terminal, allowing me to use screen space more efficiently as compared to terminal tabs. It also simplifies the execution of long-running processes on remote machines. Before byobu, every time I needed to run such a process, I had to recall/google how to use nohup with output redirection, or run tmux realizing I barely understand how to use its prefixed keybindings.

It does the job without adding a lot of complexity and doesn’t require spending time learning its philosophy, tweaking configuration files, and adding extensions. Mostly, it just works. I use it with alacritty – a very minimalistic and fast terminal, although this is not necessary: byobu runs perfectly well with a default terminal emulator too.

Interestingly, byobu doesn’t seem to get much traction on the web, so the least I can do is show some appreciation for such a high-quality work and spread the word. Huge thanks to Dustin Kirkland for creating and supporting Byobu.

comments powered by Disqus