tmux and Screen

tmux and screen are so-called terminal multiplexer that allows you to run multiple terminal sessions from inside a single terminal or SSH-session. The EV3 brick has a tmux session running in the background, so that if the SSH-connection fails the program you are running continues to be executed, instead of terminating it with the SSH-session.

For the Online-RoboLab, we use the Mothership server as hop with a screen session holding the tmux session.

Useful Commands

CommandFunction
tmuxStarts a new unnamed tmux session
tmux aAttach to last tmux session
tmux a [session name]Attach to tmux session with the name [session name]
tmux lsLists all tmux sessions that are currently open

CommandFunction
screenStarts a new unnamed screen session
screen -xAttach to last screen session
screen -listLists all screen sessions that are currently open

Useful Hotkeys

The hotkeys (obviously) only work, when you are inside a running tmux session.

HotkeyFunction
Ctrl + b followed by hitting dDetach the tmux session
Ctrl + b followed by hitting sLists all open tmux sessions
Ctrl + b followed by hitting cCreate a new tab
Ctrl + b followed by hitting nSwitch to next tab
Ctrl + b followed by hitting pSwitch to previous
Ctrl + b followed by hitting [Allows you to enter scrolling mode in tmux. To exit scrolling mode press Esc
Ctrl + b followed by hitting "Split current pane horizontally
Ctrl + b followed by hitting %Split current pane vertically
Ctrl + b followed by hitting arrow keysSwitch between selected sub-pane
Ctrl + b followed by hitting zZoom into currently selected sub-pane

The hotkeys (obviously) only work, when you are inside a running screen session.

HotkeyFunction
Ctrl + a followed by hitting dDetach the screen session
Ctrl + a followed by hitting cCreate a new tab
Ctrl + a followed by hitting nSwitch to next tab
Ctrl + a followed by hitting pSwitch to previous

Advanced stuff

The EV3 brick has a hidden tmux session running that you are not supposed to attach to. Attaching to this secret session will not work with the regular commands, since you should only attach to that session via the deploy.py. If you feel confident enough with tmux about not breaking said secret session, you can attach to it by replacing the regular tmux in the commands with the following:

tmux -S /tmp/tmux/shared attach -t robolab-startup

For further reading you can check out the following links: