Skip to main content
Back to Commands
Window ManagementN/A

respawn-window

Short form: respawnw

Reuse a window to run a command, restarting it in place. Useful for windows whose command exited when remain-on-exit is on.

Synopsis

bash
tmux respawn-window [-k] [-c start-directory] [-e environment] [-t target-window] [shell-command [argument ...]]

Options

FlagDescription
-kKill the existing command first if it is still running
-c start-directorySet the working directory
-t target-windowWindow to respawn

Examples

Restart the window's command

bash
tmux respawn-window -k 'npm run dev'

Respawn window 2 with its default command

bash
tmux respawnw -t 2

Default Keybinding

N/A

Default prefix is Ctrl+b

Pro Tips

  • Pair with set -g remain-on-exit on to inspect output before respawning
  • Use -k to force-restart a still-running command