Killing a tmux session removes a terminal workspace that is no longer needed and stops every shell, editor, and job still running inside its windows and panes. Use it after detached work has finished, or when an old named session must be cleared before recreating it.
The kill-session command destroys the target session, closes windows linked only to that session, and detaches any clients attached to it. Passing the session name with -t keeps the action narrow, while -a -t reverses the cleanup by keeping one named session and removing the others.
Because this command ends the processes inside the target session, list the current sessions first, confirm the name, and verify what remains afterward. In the default tmux setup, removing the last session makes the server exit, so a follow-up list returns a no-server message instead of another session list.
Related: How to list tmux sessions
Related: How to attach to a tmux session
$ tmux list-sessions build: 1 windows (created Fri Jun 5 07:50:57 2026) ops: 1 windows (created Fri Jun 5 07:50:57 2026)
The name before the colon is the -t target for kill-session.
$ tmux kill-session -t build
Every window, pane, and running process inside build ends immediately unless that window is also linked to another session.
If tmux reports can't find session: name, list sessions again and correct the target before retrying.
$ tmux list-sessions ops: 1 windows (created Fri Jun 5 07:50:57 2026)
$ tmux list-sessions keep: 1 windows (created Fri Jun 5 07:50:57 2026) ops: 1 windows (created Fri Jun 5 07:50:57 2026) scratch: 1 windows (created Fri Jun 5 07:50:57 2026)
$ tmux kill-session -a -t keep
The -a flag kills all sessions except the target given with -t, so confirm the kept target before running it.
$ tmux list-sessions keep: 1 windows (created Fri Jun 5 07:50:57 2026)
$ tmux kill-session -t keep
$ tmux list-sessions no server running on /tmp/tmux-0/default
The numeric socket directory varies by user account, but the message itself is the normal sign that no tmux sessions remain.
Related: How to list tmux sessions
Related: How to create a tmux session