This article will describe installing byobu and usage.
Table of Contents
1 byobu
The byobu is a frontend tool for GNU screen and tmux. GNU screen and tmux can be used easily by byobu.
Using tmux as a backend is as below.
Using GNU screen as a backend is as below.
byobu will display CPU and memory usage easily.
2 Install byobu
Install byobu from default repository except CentOS.
2.1 Ubuntu 16.04 / Debian 8
Install byobu with apt.
$ sudo apt-get install -y byobu
2.2 Fedora 23
Install byobu with dnf.
$ sudo dnf install -y byobu
2.3 CentOS 7
Install byobu from epel-release repository or build Fedora 22's src.rpm. Building Fedora 22's src.rpm is as below.
$ sudo yum install -y rpmdevtools gettext desktop-file-utils automake tmux $ FEDORA=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases $ wget ${FEDORA}/22/Everything/source/SRPMS/b/byobu-5.92-1.fc22.src.rpm $ rpmbuild --rebuild byobu-5.92-1.fc22.src.rpm $ sudo yum localinstall -y ~/rpmbuild/RPMS/noarch/byobu-*.rpm
2.4 ArchLinux
Download AUR source code.
$ git clone https://aur.archlinux.org/byobu.git $ cd byobu
Read PKGBUILD file for installing dependent packages.
$ . PKGBUILD
Install packages for building.
$ sudo pacman -S --asdeps --noconfirm ${makedepends[@]}
Install packages for running.
$ sudo pacman -S --noconfirm ${depends[@]}
Build and install package.
$ makepkg $ sudo pacman -U --noconfirm byobu-*.pkg.tar.xz
2.5 OpenSUSE
Use ubuntu's source code. Install screen if you need.
sudo zypper -n in tmux LAUNCHPAD=https://launchpad.net wget -q ${LAUNCHPAD}/byobu/trunk/5.112/+download/byobu_5.112.orig.tar.gz tar zxf byobu_5.112.orig.tar.gz cd byobu-5.112 ./configure && make && sudo make install
3 byobu usage
This article describe configuration and usage of byobu.
3.1 Run byobu
Run byobu with byobu command. If byobu session is already running, byobu command will attach it.
$ byobu
If you need to run other byobu session, please use -S option.
$ byobu -S <session-name>
3.2 byobu default prompt
byobu has a default prompt.
hiroom2@centos-7:~$
default prompt is ON by byobu-enable-prompt command and OFF by byobu-disable-prompt command. byobu-prompt command provides an interactive guide for ON/OFF.
Setting of byobu default prompt is written to ${HOME}/.bashrc.
[ -r /home/hiroom2/.byobu/prompt ] && . /home/hiroom2/.byobu/prompt #byobu-prompt#
3.3 Select backend.
Run byobu with GNU screen by byobu-screen command and with tmux by byobu-tmux. byobu-select-backend provides interactive guide for selection.
Setting of backend is written to ${HOME}/.byobu/backend.
$ cat ~/.byobu/backend BYOBU_BACKEND=tmux
3.4 Change escape key
byobu's default escape key is function key or C-a. In case of C-a is as below.
$ cat ~/.byobu/keybindings source $BYOBU_PREFIX/share/byobu/keybindings/common bindkey "^A" escape "^Aa" register x "^A"
In case of tmux, change escape key as below.
$ cat ~/.byobu/keybindings.tmux set -g prefix C-u unbind-key -n C-a
In case of GNU screen, change escape key as below.
$ cat ~/.byobu/.screenrc escape ^Uu
3.5 keybinding with escape key
When setting escape key as C-u, keybindings are as below.
C-u c | Create new window |
C-u C-p | Focus to prev window |
C-u C-n | Focus to next window |
C-u <number> | Focus to <number> window |
C-u d | Detach screen |
C-u C-u | Focus to last window |
tmux needs below setting for C-u C-u.
$ cat ~/.byobu/.tmux.conf bind C-j run "tmux last-window || true"
3.6 Change byobu config directory
byobu uses ${HOME}/.byobu directory by default.
$ byobu # ${HOME}/.byobu is used.
Change it with BYOBU_CONFIG_DIR variable.
$ BYOBU_CONFIG_DIR=${HOME}/.mybyobu byobu
3.7 status
byobu provides information on status like CPU and memory usage. This is implemented by scripts in ${BYOBU_PREFIX}/lib/byobu.
$ ls ${BYOBU_PREFIX}/lib/byobu/ # Running on byobu apport custom fan_speed memory release trash arch date hostname menu services updates_available battery disk include network session uptime color disk_io ip_address processes swap users cpu_count distro load_average raid time whoami cpu_freq ec2_cost logo rcs_cost time_binary wifi_quality cpu_temp entropy mail reboot_required time_utc
Set these scripts to tmux_right or screen_lower_right in ${HOME}/.byobu/status, information on status will be changed. screen_xxx always needs color.
$ cat ~/.byobu/status # Screen has two status lines, with 4 quadrants for status screen_upper_left="color" screen_upper_right="color" screen_lower_left="color" screen_lower_right="color load_average memory disk time" # Tmux has one status line, with 2 halves for status tmux_left= tmux_right="load_average memory disk time"
In case of tmux is as below.
tmux can modify interval of redrawing status.
$ cat ~/.byobu/.tmux.conf set -g status-interval 15 # default 15 (seconds)
GNU screen only redraw on screen_lower_right except time scripts.