Byobu - Multiple windows in Terminal
Byobu is a light, powerful, text-based window manager based on GNU Screen. Using Byobu, you can quickly create and move between different windows over a single SSH connection or TTY terminal, monitor dozens of important statistics about your system, detach and reattach to sessions later while your programs continue to run in the background.
Last update: 2022-05-07
Table of Content
Install Byobu#
Byobu is an easy-to-use wrapper around the tmux
(or screen
) terminal multiplexer. Byobu’s primary features include multiple console windows, split panes within each window, notifications and status badges to display the status of the host, and persistent sessions across multiple connections.
Byobu’s primary features include multiple console windows, split panes within each window, notifications and status badges to display the status of the host, and persistent sessions across multiple connections.
Ubuntu should come with Byobu installed by default. To check that Byobu is installed, try running this command to output its version.
byobu --version
If it is not installed, install it with a simple command:
sudo apt install -y byobu
Byobu can be configured to run by default at every text login (SSH or TTY). That behavior can be toggled with the byobu-enable
and byobu-disable
commands.
Insert below line to the end of ~/.bashrc
will run Byobu whenever a local terminal is run:
_byobu_sourced=1 . /usr/bin/byobu-launch 2>/dev/null || true
When running Byobu for the first time, it will start with just in a single window. The bottom of the screen has the status bar, which displays OS and version, a list of open windows, and various system metrics like pending updates, RAM usage and time and date.
A session is simply a running instance of Byobu. A session consists of a collection of windows, which are basically shell sessions, and panes, which are windows split into multiple sections.
Press Ctrl-F6
or type exit
to end a session.
Key Bindings#
Byobu is a configuration layer on top of GNU Screen. As such, all of GNU Screen’s keybindings work in Byobu exactly as in Screen. Moreover, Byobu provides a comprehensive, advanced set of commands bound to the F-keys on most keyboards.
Windows Management
Key | Description |
---|---|
F2 |
Create a new window |
Shift -F2 |
Split the screen horizontally |
Ctrl -F2 |
Split the screen vertically |
F3 |
Move to the previous window |
Shift -F3 |
Move focus to the next split |
F4 |
Move to the next window |
Shift -F4 |
Move focus to the previous split |
Shift -Arrows |
Move focus |
Session management
Key | Description |
---|---|
Ctrl -D |
Exit the session |
F6 |
Detach from the session and logout |
Shift -F6 |
Detach from the session, but do not log out |
Ctrl -F5 |
Reconnect any SSH/GPG sockets or agents |
Misc.
Key | Description |
---|---|
F5 |
Refresh all status notifications |
F7 |
Enter scroll back/search mode |
F8 |
Rename the current window |
F9 |
Launch the Byobu Configuration Menu |
F12 |
GNU Screen’s Escape Key |
Alt -Page Up |
Scroll back through this window’s history |
Alt -Page Down |
Scroll forward through this window’s history |
Shift -F5 |
Collapse all splits |
Shift -F12 |
Toggle all of Byobu’s keybindings on or off |
Copy & Paste, Search
Each window in Byobu has up to 10000 lines of scroll back history, so a user can enter and navigate using the Alt-PageUp
and Alt-PageDown
keys. Exit this scroll back mode by hitting Enter
.
Copy and paste text from scroll back mode:
- Press the
Space bar
to start highlighting text - Use
up
/down
/left
/right
/page up
/page down
to select the text - Press
Enter
to copy the text - Paste the text using
alt-insert
orctrl-a-]
Search up and down in scroll back mode:
- Press
/
to search down - Press
?
to search up
Actually, in scroll back mode, Byobu support vi
-like commands:
h - # Move the cursor left by one character
j - # Move the cursor down by one line
k - # Move the cursor up by one line
l - # Move the cursor right by one character
0 - # Move to the beginning of the current line
$ - # Move to the end of the current line
G - # Moves to the specified line (defaults to the end of the buffer)
ctrl + b - # Page up
ctrl + f - # Page down
/ - # Search forward
? - # Search backward
n - # Moves to the next match, either forward or backward
Mouse mode#
Type F12
, then :
(to enable the internal terminal), then enter the command
set mouse on
for other commands, run
list-commands
Or press Alt-F12
to toggle mouse.
Actions in the mouse mode:
- Switch between active panes and windows. Click on a window name or pane to switch.
- Scroll, with the mouse wheel or trackpad
- Resize panes by dragging and dropping
To enable mouse support by default for all these operations, add these lines to ~/.byobu/profile.tmux
:
set -g mouse on
set -g mouse-select-pane on
set -g mouse-select-window on
set -g mouse-resize-pane on
set -g mouse-utf8 on
The Backend Multiplexer#
By default, Byobu will use tmux
as the backend multiplexer. However, if a user prefers to use screen, they can easily change the enabled backend.
byobu-select-backend
Select the byobu backend:
1. tmux
2. screen
Tweaks#
Byobu uses default border characters from tmux
which shows bold borderlines.
Those borderlines are made up of rows and columns in the console, and they are indivisible. In a text-based terminal there is no structural element smaller than one character “cell” (which is about the size of that block cursor). The only way to reduce the size of the borders is to reduce the size of all rows/columns.
Fortunately, we can manipulate the colors to give the appearance of a thinner border: set the foreground to the desired color and set the background to the background color of panes. For the latter default
value is often sufficient.
For example, change the borderline to orange, add these lines to ~/.byobu/profile.tmux
:
set -g pane-active-border-style fg=colour208,bg=default