Skip to content

Keep shells running with tmux

With a persistent session the shell runs inside tmux (or screen) on the server. A dropped connection, a closed tab or a sleeping Mac does not stop what runs in it; the next connection attaches to the same shell.

tmux 3.0a or newer gives the integrated mode (the tab’s own scrollback and mouse):

Terminal window
tmux -V # tmux 3.4

Older tmux or only screen also work, as normal clients. Nothing has to be installed by KryoDesk.

Open the session dialog (Edit session) → Advanced SSH settings:

Persistent session set to Auto

  • Persistent session: Auto: tmux, else screen (or tmux if screen must not be used).
  • Session name: leave empty for kd-<session name>, or give a name (letters, digits, _, -, up to 64 characters). Tabs with the same name attach to the same shell.

OK. To try it once without changing the session, use Execute in tmux/screen in the session’s context menu.

After the login the tab prints in grey what it does, for example:

Persistent session 'kd-web-01': looking for tmux and screen on the server...
Using tmux (integrated): tmux 3.4 (/usr/bin/tmux). Session 'kd-web-01' not running: creating it.
$ exec /bin/sh -c 'unset TMUX; TERM=xterm-256color; export TERM; exec '\''/usr/bin/tmux'\'' -u -C new-session -A -s '\''kd-web-01'\'' -x 120 -y 40'

new-session -A creates the session or attaches to an existing one. When the session existed, KryoDesk restores its history and screen in the tab.

Terminal context menu with Detach from tmux and End tmux session

Detach and End in the terminal context menu.

  • Close the tab, or let the connection drop: the shell keeps running.
  • Right-click in the terminal → Detach from tmux ‘kd-web-01’: ends the connection, keeps the shell.
  • Open the session again: the tab attaches to the same shell.
  • Right-click → End tmux session ‘kd-web-01’…: asks, then runs tmux kill-session -t kd-web-01; every program in it ends.

From a plain SSH shell you can reach it too: tmux attach -t kd-web-01.

tmux (integrated) tmux classic
Needs tmux ≥ 3.0a any tmux
Scrolling, selection The tab’s own tmux copy mode (the wheel enters it)
tmux keys (Ctrl+B), status line, tmux splits Not used Available

Pick tmux classic in Persistent session to get tmux’s keys and status line even with a recent tmux. Details: SSH sessions → Persistent sessions.

Scroll or pinch to zoom · drag to move · double-click to zoom · Esc or click outside to close