How to Share a Terminal Session with Friends

If you are a command-line junkie, you have most likely spent hours troubleshooting broken scripts or writing your own. This process can be exhausting for one person, and you have probably wished for a simple way to share your terminal session with friends so they could assist you. Linux/Unix make it extremely easy with a simple terminal program called Byobu. Byobu is an extension of terminal multiplexers’ GNU Screen or TMUX for short, and allows you to share a terminal session with as many people as you want.

Installing Byobu on most Linux distributions is incredibly easy. Open your terminal and execute the appropriate command for your distribution.

Debian/Ubuntu/Linux Mint (and other Debian-based or Ubuntu-based distros):

sudo apt-get install byobu

CentOS/Red Hat Linux/Fedora:

sudo yum install byobu

ArchLinux:

sudo pacman -Sy byobu

Gentoo:

sudo emerge byobu

Installation on Mac OS X is almost as simple. The only requirement is that you have Homebrew installed. Homebrew is an unofficial package-manager for Mac OS X. It makes installing command-line utilities extremely easy.

To install Homebrew, open your terminal by navigating to “Finder -> Utilities” and locating the terminal icon.

mac-finder-open-terminal

Paste the following command to begin the installation, and type your password when prompted.

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Once installation is complete, you are ready to install Byobu.

sudo brew install byobu

Byobu’s default configuration options will let you share your screen directly after install. Once you have installed byobu, you can create a session instantly by typing byobu.

byobu

Now open up a second terminal and do the same thing. You will instantly be dropped into the same byobu session as the first.

byobu-local-screen-compare

Obviously, connecting locally to a Byobu session on the same computer is fairly useless, but Byobu works remotely as well over SSH.

If you are running a remote server, first connect to it over SSH like normal.

ssh user@somehost

Once again, type byobu.

Repeat this process with as many people as you want. Instantly, they will attach to your Byobu session. Each of them will be able to view and control the session.

Byobu remote connect to server from first client:

byobu-session-1

Byobu remote connect to server from second client:

byobu-session-2

Byobu has many additional features that can be accessed via keyboard shortcuts.

  • Create a new terminal session inside Byobu: f2
  • Switch between terminal sessions inside Byobu: f4
  • Detach from Byobu session and logout: f6
  • Split the Byobu screen vertically: control + f2
  • Split the Byobu screen horizontally: shift + f2
  • Launch the Byobu configuration menu: f9

byobu-configuration-menu

From the configuration menu, you can change the display notifications at the bottom of the terminal as well as launch Byobu from the startup. More advanced users can also set an alternate escape sequence which by default is “Ctrl + A”.

For more cool tips and tricks such as custom background colors, check out Ubuntu’s Byobu documentation.