lazy-tmux

CLI

Command / FlagDescription
saveSave current or selected sessions to disk
restore --session NAMERestore a single session from disk
pickerOpen session picker and restore selected session (default: TUI)
bootstrap [--session last|NAME]Restore one session automatically at tmux startup
daemon [--interval DURATION]Periodically save all sessions in the background
listList saved sessions
version (--version, -v)Print the version
config gen / config showWrite a base config file, or print the effective config lazy-tmux actually reads
wakeup --session NAMERestore a saved session (lazy load) that is not currently running
sleep --session NAME [--scrollback] [--scrollback-lines N]Save session state (with optional scrollback) and close a running session
--fzf-engineUse fzf backend instead of built-in TUI
--fzf-engine --windowsfzf backend: list and pick a specific window (not just a session), then restore its session focused on it
--restore-timeout DURATIONMax wait for restored pane commands to start before the command returns (e.g. 5s; 0 disables waiting)
--session-sort EXPRSession sort (field[:asc|desc],...) fields: last-used, captured, name, windows, panes
--window-sort EXPRWindow sort (field[:asc|desc],...) fields: index, name, panes, cmd
--scrollbackCapture shell pane scrollback (opt-in)
--scrollback-lines NMaximum captured lines per shell pane (default: 5000)

Sorting examples

# Sort sessions by name, then by captured time (newest first)
lazy-tmux picker --session-sort "name:asc,captured:desc"

# Sort windows by pane count, then by name
lazy-tmux picker --window-sort "panes:desc,name:asc"

# Use same sorting with fzf backend
lazy-tmux picker --fzf-engine --session-sort "last-used:desc,name:asc"

# fzf backend, but pick an individual window instead of a whole session
lazy-tmux picker --fzf-engine --windows --window-sort "name:asc"

Sorting behavior

Default directions (when :asc|:desc is omitted):

  • sessions: name=asc, all other session fields = desc
  • windows: index=asc, name=asc, all other window fields = desc

Current defaults (if no sort flags are passed):

  • sessions: last-used:desc,captured:desc,name:asc
  • windows: index:asc,name:asc

Validation behavior:

  • unknown fields are rejected with an error.
  • invalid direction values are rejected (asc and desc only).
  • duplicate fields in one expression are rejected.

Scrollback capture

By default, scrollback capture is disabled. Enable it explicitly:

lazy-tmux save --all --scrollback --scrollback-lines 5000
lazy-tmux daemon --interval 5m --scrollback --scrollback-lines 5000

Behavior:

  • captures tmux pane scrollback only for panes that currently run an interactive shell (no detected foreground app command).
  • stores scrollback as sidecar files and references them from session snapshots.
  • on restore, writes captured scrollback back into pane tty before command replay.

Storage layout:

  • ~/.local/share/lazy-tmux/sessions/*.json
  • ~/.local/share/lazy-tmux/scrollback/<session>/*.log

Storage

Default directory:

  • ~/.local/share/lazy-tmux/index.json
  • ~/.local/share/lazy-tmux/sessions/*.json
  • ~/.local/share/lazy-tmux/scrollback/*

Override via:

  • env: LAZY_TMUX_DATA_DIR
  • flag: --data-dir
  • config: data_dir in the TOML config file (see the Configuration page)

Author: Anton Grishin (alchemmist), anton.ingrish@gmail.com

OpenSource: alchemmist/lazy-tmux

© 2026 lazy-tmux