LinuxCommandLibrary

tmux

Maintain terminal sessions persistently

TLDR

Start a new session

$ tmux
copy

Start a new named [s]ession
$ tmux [[new|new-session]] -s [name]
copy

List existing sessions
$ tmux [[ls|list-sessions]]
copy

Attach to the most recently used session
$ tmux [[a|attach]]
copy

Detach from the current session (inside a tmux session)
$ <Ctrl b><d>
copy

Create a new window (inside a tmux session)
$ <Ctrl b><c>
copy

Switch between sessions and windows (inside a tmux session)
$ <Ctrl b><w>
copy

Kill a session by [t]arget name
$ tmux kill-session -t [name]
copy

SYNOPSIS

tmux [options] [command [flags]]

PARAMETERS

new-session
    Create new session

attach-session
    Attach to existing session

list-sessions
    List all sessions

kill-session
    Destroy a session

-t TARGET
    Specify target session/window/pane

-d
    Detach other clients

-s NAME
    Session name

DESCRIPTION

tmux is a terminal multiplexer that allows multiple terminal sessions within a single window. It enables detaching and reattaching sessions, splitting windows into panes, and maintaining persistent sessions across disconnections. tmux is essential for remote work and managing multiple terminal workflows.

CAVEATS

Default prefix key is Ctrl+b. Requires terminal with proper support. Configuration in ~/.tmux.conf.

KEY BINDINGS (AFTER CTRL+B)

c - New window
n/p - Next/previous window
% - Split vertically
" - Split horizontally
d - Detach
x - Kill pane
z - Toggle zoom

SEE ALSO

screen(1), byobu(1), dtach(1)

Copied to clipboard