tmuxStarts a new tmux session with a default numerical name.
A terminal multiplexer: split windows into panes, keep sessions alive after disconnect and script complex layouts.
sudo apt install tmuxtmux lsLists all currently running tmux sessions.
tmux attach -t [name]Attaches to an existing background session identified by its name.
Example
tmux attach -t productiontmux attach -d -t [name]Attaches to a session and detaches any other clients currently attached to it.
Example
tmux attach -d -t devPrefix + dDetaches from the current session, leaving it running in the background.
Example
Ctrl-b dtmux rename-session -t [current] [new]Renames an existing session to a new label.
Example
tmux rename-session -t 0 webserverPrefix + $Interactively prompts to rename the current session.
Example
Ctrl-b $tmux kill-session -t [name]Terminates a specific session and closes all its windows and panes.
Example
tmux kill-session -t databasetmux kill-serverKills the tmux server and all sessions, windows, and panes immediately.
Prefix + cCreates a new window within the current session.
Example
Ctrl-b ctmux new-window -n [name]Creates a new window with a specified name.
Example
tmux new-window -n logsPrefix + ,Prompts to rename the current window.
Example
Ctrl-b ,Prefix + nSwitches to the next window in the list.
Example
Ctrl-b nPrefix + pSwitches to the previous window in the list.
Example
Ctrl-b pPrefix + [number]Switches directly to the window at the specified index.
Example
Ctrl-b 2Prefix + wOpens an interactive list to select a specific window from any session.
Example
Ctrl-b wPrefix + &Prompts confirmation to kill (close) the current window.
Example
Ctrl-b &tmux move-window -rRenumbers all windows in the session sequentially to remove gaps.
Prefix + %Splits the current pane vertically into two side-by-side panes.
Example
Ctrl-b %Prefix + "Splits the current pane horizontally into two top-and-bottom panes.
Example
Ctrl-b "Prefix + oCycles focus to the next pane in the current window.
Example
Ctrl-b oPrefix + Arrow KeyMoves focus to the pane in the direction of the arrow key.
Example
Ctrl-b UpPrefix + xPrompts confirmation to kill (close) the current pane.
Example
Ctrl-b xPrefix + zToggles zoom on the current pane, making it fill the entire window.
Example
Ctrl-b zPrefix + {Swaps the current pane with the previous pane.
Example
Ctrl-b {Prefix + }Swaps the current pane with the next pane.
Example
Ctrl-b }Prefix + SpaceCycles through the available automated pane layouts.
Example
Ctrl-b Spacetmux break-paneDetaches the current pane and moves it into its own new window.
tmux join-pane -t [window]Moves the current pane into an existing window.
Example
tmux join-pane -t :1tmux resize-pane -[U/D/L/R] [amount]Resizes the current pane in a specific direction by a number of cells.
Example
tmux resize-pane -D 10tmux display-panesBriefly displays the index numbers of visible panes.
Example
Prefix + qtmux select-pane -t [id]Selects a pane directly by its visible index number.
Example
tmux select-pane -t 1Prefix + [Enters copy mode to scroll through history and select text.
Example
Ctrl-b [Prefix + PgUpEnters copy mode and scrolls up one page immediately.
Example
Ctrl-b PgUpqQuits copy mode and returns to the command prompt.
gGoes to the very top of the scrollback history.
Example
g (in vi-copy mode)GGoes to the very bottom of the scrollback history.
Example
G (in vi-copy mode)/Searches forward in the scrollback buffer for a specific pattern.
Example
/error (in vi-copy mode)?Searches backward in the scrollback buffer for a specific pattern.
Example
?warning (in vi-copy mode)SpaceStarts text selection in copy mode.
Example
Space (in vi-copy mode)EnterCopies the selected text to the tmux paste buffer and exits copy mode.
Example
Enter (in vi-copy mode)Prefix + ]Pastes the most recently copied text from the tmux buffer.
Example
Ctrl-b ]tmux list-buffersDisplays a history of copied text segments stored in buffers.
tmux show-bufferDisplays the contents of the current paste buffer without pasting it.
tmux save-buffer [file]Saves the contents of the paste buffer to a file.
Example
tmux save-buffer ~/clipboard.txttmux load-buffer [file]Loads text from a file into a new paste buffer.
Example
tmux load-buffer ~/config.txttmux show-options -gDisplays the global session options currently active.
tmux show-window-options -gDisplays the global window options currently active.
tmux source-file [path]Reloads the tmux configuration file without restarting the server.
Example
tmux source-file ~/.tmux.confPrefix + :Opens the tmux command prompt for entering commands interactively.
Example
Ctrl-b :tmux set-option -g history-limit [lines]Increases the scrollback buffer size to store more history.
Example
tmux set-option -g history-limit 10000tmux set-option -g base-index 1Sets window numbering to start at 1 instead of 0.
tmux set-window-option -g pane-base-index 1Sets pane numbering to start at 1 instead of 0.
tmux set-option -g renumber-windows onAutomatically renumbers windows when one is closed.
tmux set-option -g mouse onEnables mouse support for selecting panes and resizing.
tmux set-option -g status-position [top/bottom]Moves the status bar to the top or bottom of the screen.
Example
tmux set-option -g status-position toptmux set-option -g status-bg [color]Changes the background color of the status bar.
Example
tmux set-option -g status-bg redtmux set-option -g status-left-length [number]Increases the character limit for the left side of the status bar.
Example
tmux set-option -g status-left-length 50tmux set-option -g status-interval [seconds]Sets how frequently the status bar updates in seconds.
Example
tmux set-option -g status-interval 1tmux new-session -d -s [name] '[command]'Starts a detached session that immediately runs a specific background command.
Example
tmux new-session -d -s backup 'sh ./backup.sh'tmux send-keys -t [target] '[keys]' EnterSends keystrokes to a specific pane as if typed by the user.
Example
tmux send-keys -t mysession:0 'top' Entertmux run-shell '[script]'Executes a shell command or script in the background.
Example
tmux run-shell '~/scripts/alert.sh'tmux if-shell '[condition]' '[cmd1]' '[cmd2]'Executes a tmux command conditionally based on a shell command's success.
Example
tmux if-shell 'true' 'display "Yes"' 'display "No"'tmux wait-for [channel]Blocks execution until a signal is received on a specific channel.
Example
tmux wait-for task_completetmux wait-for -S [channel]Sends a signal to a waiting tmux client to resume execution.
Example
tmux wait-for -S task_completetmux set-window-option synchronize-panes onBroadcasts all keystrokes to every pane in the current window simultaneously.
tmux pipe-pane -o '[command]'Pipes all output from the current pane to a file for logging.
Example
tmux pipe-pane -o 'cat >> ~/session.log'tmux pipe-paneStops piping output from the current pane.
tmux capture-pane -S -Captures the entire visible text and scrollback history of the pane into a buffer.
tmux respawn-pane -kKills the process in the pane and restarts the shell or original command.
tmux respawn-window -kKills processes in the window and restarts the window environment.
tmux set-window-option monitor-activity onHighlights the window in the status bar if output activity is detected.
tmux set-window-option monitor-silence [seconds]Alerts if no output is received in a pane for a specified duration.
Example
tmux set-window-option monitor-silence 30tmux set-option -g visual-bell onFlashes the status bar instead of making a sound when a bell occurs.
tmux lock-sessionLocks the session requiring a password (if configured) to resume.
tmux list-clientsShows all users or terminals currently attached to the session.
tmux detach-client -t [client]Forcibly removes a specific client connection from the session.
Example
tmux detach-client -t /dev/pts/1tmux link-window -s [src] -t [dst]Links a window so it appears in multiple sessions simultaneously.
Example
tmux link-window -s dev:0 -t prod:1tmux unlink-window -t [target]Removes a linked window from the current session without destroying it.
Example
tmux unlink-window -t prod:1tmux refresh-client -SUpdates the client status line and redraws the screen.
tmux select-layout tiledArranges all panes in the current window in a tiled grid.
Example
Prefix + Alt + 5tmux select-layout even-horizontalArranges all panes in equal-width columns.
Example
Prefix + Alt + 1tmux select-layout even-verticalArranges all panes in equal-height rows.
Example
Prefix + Alt + 2tmux select-layout main-horizontalArranges one large main pane on top and smaller panes below.
Example
Prefix + Alt + 3tmux select-layout main-verticalArranges one large main pane on the left and smaller panes on the right.
Example
Prefix + Alt + 4tmux rotate-windowRotates the positions of panes within the current window.
Example
Prefix + Ctrl-otmux split-window -h 'htop'; tmux split-window -v 'tail -f /var/log/syslog'One-line command to set up a monitoring dashboard.
tmux set-hook -g alert-activity 'run-shell "echo Alert >> ~/alerts.log"'Configures a hook to run a script whenever activity is detected.
tmux set-hook -g session-created 'source-file ~/.tmux_soc.conf'Automatically applies a specific config when a new session is created.
tmux switch-client -t [session]Switches the current client to a different session without detaching.
Example
tmux switch-client -t backendtmux last-windowToggles between the current window and the previously selected window.
Example
Prefix + ltmux last-paneToggles between the current pane and the previously active pane.
Example
Prefix + ;The original terminal multiplexer: detachable sessions, multiple windows and serial-console access.
OpenSSH: secure remote login, key management, file transfer and port forwarding — local, remote and dynamic SOCKS tunnels.
Runs a command repeatedly and shows its output full-screen, highlighting what changes between runs.