Mr. Editor-in-chief Mr. Editor-in-chief 1 min read 165 words 53 views

Basic tmux Commands for Terminal Sessions

Basic tmux Commands

tmux keeps terminal sessions running in the background, even after you disconnect from SSH.

Start a new session

shell
tmux new -s work

The -s work option names the session. To start an unnamed session, run tmux.

List sessions

shell
tmux ls

Detach from a session

Press Ctrl + b, then press d to detach and put the session in the background. Any programs inside it keep running.

Reattach to a session

shell
tmux attach -t work

Short form:

shell
tmux a -t work

Rename a session

shell
tmux rename-session -t work project

Remove a session

shell
tmux kill-session -t work

To remove all tmux sessions:

shell
tmux kill-server

Inside a session, run exit to close the current shell. If it is the last shell, tmux removes the session.

Quick workflow

shell
tmux new -s work
tmux ls
tmux attach -t work
tmux kill-session -t work
Copied to clipboard

Share this post

Related Posts