Start a detached session from a script

Start a background session and send a command to it; it keeps running after SSH disconnects

tmux new-session -d -s work && tmux send-keys -t work 'tail -f /var/log/app.log' Enter

tool
tmux17 commands
tags
tmuxtroubleshootingmonitoring

More tmux commands

  • tmux capture-pane -p -S -3000 -t work > /tmp/pane.log

    Save the last 3000 lines of a pane to a file for review, without attaching

  • tmux new-session -s work

    Start a new tmux session called "work"

  • tmux attach-session -t work

    Attach to an existing session by name

  • tmux ls

    Show all running tmux sessions

  • <prefix> d

    Leave the current session; it keeps running in the background

all 17 tmux commands