Byobu screen

Maith Egeek
2 min readMay 18, 2023

If you want to launch a long command, but don’t want to risk it terminating if the connexion interrupts, you need a terminal emulator. As such, you will be able to join an already running session, and exit it without closing it.

Recommended solution : byobu, with screen
https://doc.ubuntu-fr.org/byobu (french link)
https://www.byobu.org/
https://doc.ubuntu-fr.org/screen (french link)
https://en.wikipedia.org/wiki/GNU_Screen

Creating and Joining Sessions

To create a session (note : it is very important you name your screen session, otherwise, you might have trouble retrieving it later, this particularly important for a machine that is shared with multiple users). All those command work also by replacing byobu-screen by simply screen

byobu-screen -S my_session_name

To see existing sessions:

byobu-screen -ls

To join an existing session:

byobu-screen -r my_session_name

(if there is only one open session, you don’t need to specify the name after -r to join an already existing.

If your can’t manage to join an existing session because it show that it is still attached (when listing with byoby-screen -ls):

 screen -r -d id_session_number

Useful commands

  • help Ctrl + a + ?
  • exit session without closing itCtrl + a + d
  • close terminal Ctrl + d
  • new terminal Ctrl + a + c
  • next terminal Ctrl + a + n
  • got to terminal i (where iis a number) Ctrl + a + i
  • scroll up and down Ctrl-A [This will activate copy mode in GNU/screen. Now, you can scroll up/down and look at your data. Use the following keys:
  1. Ctrl-u and Ctrl-d scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screen-full).
  2. Ctrl-b and Ctrl-f scroll the display up/down a full screen.

Splitting screens

From Byobu’s help page:

Split screen horizontally:

  • Shift+F2 or
  • Ctrl+A then |

Split screen vertically:

  • Ctrl+F2 or
  • Ctrl+A then %

Switch focus:

  • Shift+↑ ↓ ← → or
  • Ctrl+A Tab

Unsplit/Collapse split screens :

  • Shift-F5
  • Ctrl-A :remove enter .

--

--