Do you ever feel like graphical user interfaces have gone too far?
Do you pine for the days when your entire desktop consisted of one console window?
Or do you simply want luxury and productivity when you ssh into a headless server?

This is Part 1 of a series of posts outlining my recipe for living comfortably in the terminal.

Part One: Byobu

You’ve logged in to your remote server. This cold, featureless prompt stares at you:

user@host:~$

Where do you go from here? Is there anything to do but ls over and over?
Take a deep breath. First, you must expand your view.

sudo apt-get install byobu
byobu

A terminal running byobu

One terminal makes things possible. Multiple terminals make things easy.

Byobu is a pre-configured wrapper around tmux (previously screen), a program that creates multiple virtual terminals housed within one. On its own, tmux (a terminal multiplexer) can keep your session alive even when your SSH connection breaks, and allow you to switch between multiple terminals with a keypress. byobu is tmux easy mode. Everything has been configured to use F keys to move between windows, and there are a toggleable selection of status indicators along the bottom, showing things like uptime, disk space and other stats. This multiple-terminal capability is the foundation that makes an easy life in the shell possible. It’s the first thing I run on every ssh login.

Byobu Function Key Basics

  • F1 is help (shocking).
  • F2 opens a new window (or tab if you prefer to think of it that way).
  • F3 and F4 switch to the previous and next window respectively.
  • F6 detaches byobu - essentially closing your view into the multiplexed terminals, which carry on running in the background, and returning to your original single bash prompt.
  • F7 enters ‘scrollback mode’, which is like looking through that window’s history with less - PgUp and PgDown function normally here, in byobu you can’t usually scroll up through previous output without entering this mode.
    q exits back to normal mode. / searches within the window’s history.
  • F9 opens the options screen. Mostly useful for toggle status notifications in which you can pick and choose which widgets display along the bottom.

You can have a text editor open in one tab and a shell in the second, and flick between them with F3. When you want to disconnect but leave your session running, detach with F6. When you login again, run byobu and it will reattach with everything still where you left it. You can even connect to it from multiple places and share the session between them.

If you really want to shut down your whole session, simply type exit on the shell of each tab, and it will close that tab. When all tabs are closed, byobu is closed.

This forms the basis for the terminal ‘desktop’. In other posts, I’ll go into various useful programs, many of them ncurses based, that can turn a byobu tab into a text editor, email client, web browser and more. Who needs X11 anyway?