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

tmux

Starts a new unnamed tmux session

tmux a

Attach to last tmux session

tmux a [session name]

Attach to tmux session with the name [session name]

tmux ls

Lists all tmux sessions that are currently open


CommandFunction

screen

Starts a new unnamed screen session

screen -x

Attach to last screen session

screen -list

Lists 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 d

Detach the tmux session

Ctrl + b followed by hitting s

Lists all open tmux sessions

Ctrl + b followed by hitting c

Create a new tab

Ctrl + b followed by hitting n

Switch to next tab

Ctrl + b followed by hitting p

Switch 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 keys

Switch between selected sub-pane

Ctrl + b followed by hitting z

Zoom into currently selected sub-pane

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

HotkeyFunction

Ctrl + a followed by hitting d

Detach the screen session

Ctrl + a followed by hitting c

Create a new tab

Ctrl + a followed by hitting n

Switch to next tab

Ctrl + a followed by hitting p

Switch 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: