tmux
tmux keeps terminal sessions running when you detach or lose an SSH connection. A session contains windows; each window contains one or more panes, each with its own terminal. Detaching leaves those terminals running, but does not protect them from a server reboot.
In your shell, start a named session with tmux new -s work. To return later, use tmux attach -t work; tmux ls lists existing sessions.
Basic Tmux Keybindings
Press Ctrl+B, release it, then press the next key. This prefix tells tmux to interpret the following key as a command rather than send it to the program in the pane.
Configuring Tmux
Store persistent settings in $HOME/.tmux.conf. Open that file from your shell:
vi "$HOME/.tmux.conf"
Put the following tmux commands inside the file, not in your shell. They change the prefix from Ctrl+B to Ctrl+A:
# Set new prefix to Ctrl+A
set -g prefix C-a
unbind C-b
bind C-a send-prefix
Customizing the Status Bar
Add these settings to the same .tmux.conf file to customize the status-bar colors. To apply a saved file to a running tmux server, run tmux source-file "$HOME/.tmux.conf" from your shell.
set -g status-style bg=cyan
set -g window-status-style bg=yellow
set -g window-status-current-style 'bg=red,fg=white'
The Missing Semester command-line environment lesson connects Tmux to shell job control and SSH. Work through detaching and reattaching a session, then compare that behavior with suspending a foreground job using Ctrl-Z. This clarifies which process the shell pauses and what Tmux keeps running.