APC Australia

Terminal multiplexe­r

Shashank Sharma is enthralled by screen multiplexe­rs, and Byobu presents an elegant and efficient approach to managing multiple windows.

-

Terminal multiplexe­rs such as Tmux and Screen are part of the daily routine for most commandlin­e warriors. These amazing tools can be used to run multiple shell sessions within a single terminal, or display more than one applicatio­n in a single window. But these tasks are beyond the capabiliti­es of regular terminal emulators, and you must use multiplexe­rs.

Although multiplexe­rs such as Screen have been around since the late 1980s, they aren’t exactly welcoming to new users or CLI novices. Byobu aims to bridge the gap by providing a wrapper over multiplexe­rs such as Screen and Tmux, as well as add some features to appeal to even new users.

Released under the GPLv3 Licence, Byobu started its journey as a wrapper for Screen, and was only available for Ubuntu. It has since adopted Tmux as the default underlying multiplexe­r and can be found in the software repositori­es of most popular distributi­ons such as Debian, Fedora, Arch and Gentoo.

If you’re running Debian or Ubuntu, or a derivative distributi­on, you can install Byobu with the sudo apt install byobu command. The sudi dnf install byobu command can similarly be used to install the project on RPM-based distributi­ons. While it’s possible to build it from source, the project itself recommends using your distro’s package manager to install it.

Byobu is a Japanese word that refers to a folding, decorative, multi-panel screen typically used as room dividers. It’s not a multiplexe­r itself, but an enhancemen­t of the rather vanilla Screen and Tmux multiplexe­rs. It aims to provide a simplified and more welcoming user interface to these robust utilities. Byobu also stands out from these tools because of its status bar, located at the bottom, which is used to display useful system informatio­n.

You can run Byobu by invoking the byobu command, without any command options. While Byobu defaults to Tmux as the underlying multiplexe­r, you can run the byobu-screen command instead if you prefer Screen. The latter command only works if you already have Screen installed. If not, make sure to install it using the package manager on your distro or Byobu will exit with an error.

If you’ve never used a multiplexe­r such as Tmux or Screen, you should know that these tools enable you to easily split the terminal into different panes. Each of the different panes acts as an independen­t

terminal. This makes it possible for you to perform myriad tasks from a single interface.

After starting Byobu, you’ll be dropped to the shell prompt, with the status bar at the bottom of the screen showing a wealth of informatio­n. The status bar shows, from left to right, the name and version of your distributi­on, uptime, CPU and memory info, total disk space and current date and time.

Before anything else, press the F9 key to launch Byobu’s Configurat­ion menu. It has four entries. Your first step should be to look through the Quick Start Guide from this Configurat­ion menu. This lists all the keybinding­s that you can use with Byobu, such as pressing Ctrl-F2 to split the screen vertically or Shift+arrow keys to navigate between the different split panes. The easy availabili­ty of the Quick Start guide is a useful addition by Byobu to multiplexe­rs.

You can also use the Configurat­ion Menu to change the informatio­n displayed in the status bar, by selecting Toggle Status Notificati­ons and pressing Enter. You can then select the info you wish to be displayed in the status bar. In addition to the informatio­n displayed by default, you can also make visible the IP address, battery status and more.

You’ll figure out the different keybinding­s with time, but here are some of the most useful ones to help you get started:

Although it’s fairly easy to navigate between the different windows and split panes using the keybinding­s, you can also enable mouse support within Byobu. Once done, you can left-click to select the different panes and also drag-and-drop to increase or decrease the size of any pane.

You can exit a Byobu session, but still maintain the layout of the different panes/windows. This is especially useful because it saves time having to relaunch all the different panes and windows that you require. To exit Byobu, but leave the session running in the background such that you can return to it anytime you want, press F6. This detaches the Byobu session, but keeps it quietly active in the background while you tackle more pressing tasks.

Advanced usage

There’s still more that you can do with Byobu, especially if you spend a lot of time on the terminal. If your Byobu screens and panes produce a lot of output, you can search through it all using Byobu’s scrollback mode.

Press F7 to enter the scrollback mode. You can now search backwards through the selected pane/window by typing ? . You’ll notice that at the bottom of the screen, just above the status bar, a new (search up) bar appears. Type the text you wish to look up, and hit Enter. Byobu will automatica­lly highlight all matches.

The scrollback mode defaults to searching downwards, but you can also confirm this by pressing / after entering scrollback mode. The bar at the bottom now reads (search down).

Once you have a split layout that you enjoy working with, you can save it for future use by pressing Ctrl-Shift-F8. You’ll be prompted to provide a name for the layout. You can save different layouts, for different tasks, each with differentl­y sized split panes. You can display a list of all saved layouts by running the byobu-layout list command. You can then restore a saved layout by running the byobulayou­t restore ≤name≥ command.

“Although multiplexe­rs such as Screen have been around since the late 1980s, they aren’t exactly welcoming to new users or CLI novices. Byobu aims to bridge the gap by providing a wrapper over multiplexe­rs such as Screen and Tmux, as well as add some features to appeal to even new users.”

 ??  ?? The Byobu configurat­ion files are stored under the ~/. byobu or the ~/. config/byobu directory, depending on your distributi­on.
The Byobu configurat­ion files are stored under the ~/. byobu or the ~/. config/byobu directory, depending on your distributi­on.
 ??  ?? We’ve used the copy mode to select text in the first pane, and also decided to save the spilt layout for future use by pressing Ctrl-Shift-F8.
We’ve used the copy mode to select text in the first pane, and also decided to save the spilt layout for future use by pressing Ctrl-Shift-F8.

Newspapers in English

Newspapers from Australia