tmux

tmux is a terminal multiplexer: it lets you create multiple persistent terminal sessions, windows, and panes from a single screen, detach from them, and reattach later. Sessions survive network disconnections, making tmux essential for remote work over SSH.

Copy buffer and system clipboard

tmux maintains its own paste buffer, separate from the system clipboard. When mouse support is enabled, selecting text copies it into the tmux buffer, not the OS clipboard. To bridge the two:

# Output current tmux buffer to STDOUT
tmux save-buffer -
 
# Pipe tmux buffer to Linux system clipboard (requires xclip)
tmux save-buffer - | xclip -selection clipboard
 
# Pipe tmux buffer to macOS system clipboard
tmux save-buffer - | pbcopy

Key bindings (default prefix: C-b)

BindingAction
C-b [Enter copy mode (scrollback / select text)
C-b ]Paste most recent buffer
C-b dDetach from session
C-b cCreate new window
C-b % / C-b "Split pane vertically / horizontally
C-b zZoom current pane
C-b ?List all key bindings

Related: xterm (terminal emulator), screen (alternative multiplexer), ssh (remote sessions where tmux shines).

Sources

See also

  • xterm
  • screen
  • ssh