tmux is a terminal multiplexer and can be very useful in when connecting to remote servers with flaky connectivity. Programs keep running even after disconnect and can be re-attached to the existing session and continue working without starting over.
It allows to open multiple windows and panes in a single session and can be easily switched between them.
Getting started with tmux:
create a new tmux session
tmux
to create a named tmux session, useful to easily identify a session
tmux new -s <session_name>
to re-attach to an already running session
tmux attach-session -t <session_name>
#or shorter
tmux a -t <session_name>
to detach from current session and leave everything running, use ctrl+b, d
to list all running sessions
tmux ls
to scroll through the terminal contents, use
ctrl+b, <PgUp> to scroll upctrl+b, <PgDown> to scroll downto get help about the available commands and their purpose, use ctrl+b, ?.
References: