All tags
Start here · tmuxTmux for beginners, sessions, windows and panes that survive a dropped connection18 steps · 21 min read · Beginners on the Linux command lineStart the guide tmux
Narrow down
Guides2
- GuideAdvanced tmux, a config that grows with you, formats, layouts and moreThis advanced tmux guide builds on the beginners series with a modular config covering vi-style copy mode, clipboard integration, and a functional status bar. It dives into layouts, workspace scripts, formats, popups, menus, plugins like tmux-resurrect, and SSH workflows including nested tmux sessions, all tested against tmux 3.8.9 steps · 52 min read
- GuideTmux for beginners, sessions, windows and panes that survive a dropped connection18 steps · 21 min read
Shell119
- Tip
tmux new -d -s report -x 200 -y 50 'top'tmux new -d -x 200 -y 50 gives a detached session a real sizeStarts a background tmux session wider than 80 columns, so scripts don't get wrapped output.3 Dec 2026 - Tip
set -g allow-passthrough onset -g allow-passthrough on lets escape codes in a pane reach your terminalLets programs inside tmux send terminal-specific escape codes, such as iTerm2's, past tmux.2 Dec 2026 - Tip
tmux kill-servertmux kill-server ends every tmux session at onceStops the tmux server and everything running inside it.30 Nov 2026 - Tip
Ctrl-b [A in tmux copy mode adds a selection to what you already copiedCollects text from several places into one paste buffer.30 Nov 2026 - Tip
tmux new -s scratch \; set destroy-unattached onSet destroy-unattached on makes a tmux session vanish when you detachCleans up throwaway sessions as soon as you leave them.30 Nov 2026 - Tip
set -g pane-border-lines heavyset -g pane-border-lines heavy makes tmux pane borders easier to seeDraws thicker pane borders and points arrows at the active pane.30 Nov 2026 - Tip
make 2>&1 | tmux split-window -IPiping into tmux split-window -I shows output in a new paneSends a command's output from a script into a fresh pane.30 Nov 2026 - Tip
set -g main-pane-width 60%main-pane-width sets how big the main pane in a tmux layout getsControls the size of the big pane in the main layouts.30 Nov 2026 - Tip
tmux new -t work -s work2tmux new -t work starts a second session that shares the windowsLets two screens look at different windows of the same session.30 Nov 2026 - Tip
tmux has-session -t "$S" 2>/dev/null && exec tmux attach -t "$S"A small shell script builds your tmux session with all windowsRecreates the same windows, panes and commands with one command.30 Nov 2026 - Tip
set -g status-right '#{?client_prefix,#[reverse] PREFIX #[noreverse],} %H:%M'Client_prefix shows in the tmux status bar when you pressed the prefixGives you a visible sign that tmux is waiting for a key.30 Nov 2026 - Tip
tmux kill-pane -atmux kill-pane -a closes every pane except the one you are inClears all other panes in the window in one command.30 Nov 2026 - Tip
tmux select-pane -d -t 2tmux select-pane -d stops a pane from taking your typingProtects a pane, such as a running job, from stray keystrokes.30 Nov 2026 - Tip
Ctrl-b ECtrl-b E spreads tmux panes out evenly without changing the layoutEvens out pane sizes while keeping your own arrangement.30 Nov 2026 - Tip
mkdir -p ~/.config/tmuxTmux reads its config from ~/.config/tmux/tmux.conf tooLets you keep the tmux config with your other dotfiles.30 Nov 2026 - Tip
bind S command-prompt -p 'new session:' 'new-session -A -s "%%"'A tmux key that asks for a name and creates a new sessionCreates and switches to a named session from inside tmux.30 Nov 2026 - Tip
Ctrl-b ~Ctrl-b ~ shows the tmux messages you missedReopens status bar messages that disappeared too fast.30 Nov 2026 - Tip
tmux attach -r -t demotmux attach -r lets someone watch a session without typing in itAttaches a client that can see a session but not change it.30 Nov 2026 - Tip
tmux split-window -f -v -l 10tmux split-window -f adds a pane across the whole windowAdds a log strip under all your panes instead of under just one.30 Nov 2026 - Tip
setw -g window-status-current-style 'bg=yellow,fg=black,bold'window-status-current-style highlights the active tmux windowMakes the current window stand out in the status bar.30 Nov 2026 - Tip
tmux list-clientstmux list-clients shows who is attached to which sessionLists every terminal connected to tmux, with session and size.30 Nov 2026 - Tip
Ctrl-b .Ctrl-b . moves a tmux window to another number or sessionMoves the current window to a new index or another session.30 Nov 2026 - Tip
Ctrl-b CCtrl-b C opens a menu of every tmux option and key bindingLets you browse and change tmux options without the man page.30 Nov 2026 - Tip
tmux split-window -e AWS_PROFILE=stagingtmux split-window -e starts a pane with its own environment variableGives one new pane an extra environment variable without touching others.30 Nov 2026 - Tip
Ctrl-b Alt-nCtrl-b Alt-n jumps to the next tmux window with activityGoes straight to the window that rang a bell or printed output.30 Nov 2026 - Tip
Ctrl-b 'Ctrl-b ' jumps to tmux window 10 and up by numberReaches windows numbered above 9 without cycling through them.30 Nov 2026 - Tip
set -g window-style 'fg=colour247,bg=colour236'window-style dims the tmux panes you are not working inGreys out inactive panes so the active one stands out.30 Nov 2026 - Tip
set -g copy-command 'pbcopy'set -g copy-command sends every tmux copy to your system clipboardPipes copied text to pbcopy, wl-copy or xclip automatically.30 Nov 2026 - Tip
bind -n M-Left select-pane -Lbind -n M-Left lets you switch tmux panes without the prefixMoves between panes with Alt and an arrow key.30 Nov 2026 - Tip
tmux source-file -n ~/.tmux.conftmux source-file -n checks your config for errors without applying itFinds typos in a tmux config before you load it.30 Nov 2026 - Tip
Ctrl-b mCtrl-b m marks a tmux pane so you can swap or join it laterMarks one pane as the source for swap-pane and join-pane.30 Nov 2026 - Tip
set -g pane-scrollbars modalset -g pane-scrollbars modal shows a scrollbar in tmux copy modeShows where you are in a pane's history while scrolling.30 Nov 2026 - Tip
Ctrl-b DCtrl-b D lets you detach another client from a tmux sessionKicks a forgotten connection off your session from a list.30 Nov 2026 - Tip
tmux show -gv history-limittmux show -gv prints the current value of one optionChecks what an option is really set to on the running server.30 Nov 2026 - Tip
tmux attach -t main -c ~/projects/sitetmux attach -c changes the folder new tmux windows start inPoints a running session at a new project folder.30 Nov 2026 - Tip
tmux load-buffer ~/snippets/deploy.txttmux load-buffer puts a file's text in the tmux paste bufferLoads text from a file or a pipe so you can paste it anywhere.30 Nov 2026 - Tip
Ctrl-b [* in tmux copy mode searches for the word under the cursorFinds the next place a word appears without typing it.30 Nov 2026 - Tip
set -g remain-on-exit failedset -g remain-on-exit failed keeps a crashed tmux pane openLets you read the error when a pane's command fails.30 Nov 2026 - Tip
setw -g automatic-rename-format '#{b:pane_current_path}'automatic-rename-format names tmux windows after their folderShows the current folder instead of the program in window names.30 Nov 2026 - Tip
set -s command-alias[100] 'rl=source-file ~/.tmux.conf'command-alias gives a tmux command a short name of your ownCreates your own shortcuts for long tmux commands at the prompt.30 Nov 2026 - Tip
tmux resize-pane -x 80tmux resize-pane -x 80 gives a pane an exact widthSets a pane to a precise number of columns or a percentage.30 Nov 2026 - Tip
tmux swap-window -s 3 -t 1tmux swap-window -t 1 trades the places of two windowsSwaps the positions of two tmux windows.28 Nov 2026 - Tip
tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_current_command} #{pane_current_path}'tmux list-panes -a -F lists every pane on the server with its folder and commandPrints one line per pane on the whole tmux server, in a format you choose.28 Nov 2026 - Tip
tmux new-window -atmux new-window -a opens the new window right after the current oneCreates a new tmux window directly after the current one instead of at the end.28 Nov 2026 - Tip
set -g display-time 3000set -g display-time 3000 keeps tmux messages on screen longerSets how long tmux status line messages stay on screen, in milliseconds.28 Nov 2026 - Tip
set -g focus-events onset -g focus-events on tells programs inside tmux when the window gains focusPasses terminal focus in and out events through tmux to programs running inside it.28 Nov 2026 - Tip
set -g set-clipboard onset -g set-clipboard on lets tmux copy to your terminal's clipboardLets tmux copy selected text to the clipboard of your terminal, even over SSH.28 Nov 2026 - Tip
tmux rotate-window -Dtmux rotate-window shifts every pane one place without touching the layoutMoves every pane in a tmux window to the next position while keeping the layout.28 Nov 2026 - Tip
tmux find-window 'Permission denied'tmux find-window searches window names and visible text for a wordFinds the tmux window whose name, title or visible text matches a pattern.28 Nov 2026 - Tip
tmux setw monitor-silence 30Setw monitor-silence 30 highlights a tmux window that has gone quietHighlights a tmux window in the status bar after it has printed nothing for a set time.28 Nov 2026 - Tip
set -g detach-on-destroy offset -g detach-on-destroy off moves you to another session when one endsSwitches a tmux client to another session when its session closes, instead of detaching.28 Nov 2026 - Tip
set -g set-titles onset -g set-titles on makes your terminal tab show the tmux sessionMakes the terminal tab or window title show the tmux session and window name.28 Nov 2026 - Tip
tmux -L test -f /tmp/test.conf new -s trytmux -L test starts a second, separate tmux serverRuns an independent tmux server on a named socket, separate from your normal sessions.28 Nov 2026 - Tip
if-shell 'test "$(uname)" = Darwin' 'set -g status-style bg=blue' 'set -g status-style bg=green'Tmux if-shell runs a tmux command only when a shell test passesRuns a tmux command only if a shell test succeeds, so one config works on many machines.28 Nov 2026 - Tip
set -g status-interval 5set -g status-interval 5 refreshes the tmux status bar more oftenSets how often tmux redraws its status line and refreshes the commands in it.28 Nov 2026 - Tip
tmux save-buffer - | wc -ltmux save-buffer – writes your last tmux copy to stdoutWrites the newest tmux copy buffer to a file or to standard output.28 Nov 2026 - Tip
set -g word-separators ' 'set -g word-separators controls where w and b stop in tmux copy modeSets which characters tmux treats as word boundaries when you move by word in copy mode.28 Nov 2026 - Tip
setw -g aggressive-resize onsetw -g aggressive-resize on sizes tmux windows per current windowSizes a tmux window to the sessions that have it as current window.28 Nov 2026 - Tip
tmux show-environment -s SSH_AUTH_SOCKtmux show-environment -s prints the session environment as shell commandsPrints a tmux session variable as a shell command, so an old pane can pick up the new value.28 Nov 2026 - Tip
set-option -wg automatic-rename offset -g automatic-rename off stops tmux renaming your windowsStops tmux from renaming windows after the program running in them.28 Nov 2026 - Tip
tmux clock-modeCtrl-b t shows a big clock and clock-mode-style sets its formatShows a large clock in a tmux pane, in 12 or 24 hour format, with or without seconds.28 Nov 2026 - Tip
tmux new-window -S -n logs 'tail -f /var/log/syslog'tmux new-window -S -n logs jumps to a named window or creates itSwitches to a tmux window with the given name if it exists, and creates it if it does not.28 Nov 2026 - Tip
tmux clear-historytmux clear-history wipes the scrollback of a paneDeletes the scrollback of a tmux pane so copy mode starts fresh.27 Nov 2026 - Tip
tmux link-window -s work:logs -t home:tmux link-window shows the same window in two sessionsPuts one running tmux window in a second session, without starting it twice.27 Nov 2026 - Tip
set -g pane-border-status topset -g pane-border-status top puts a label on every tmux paneShows a label with a title or the running command in the border of every tmux pane.27 Nov 2026 - Tip
tmux respawn-pane -ktmux respawn-pane -k restarts the command in a pane without closing itRestarts a pane's program in place, with the same layout and starting command.26 Nov 2026 - Tip
tmux pipe-pane -o 'cat >>~/output.#I-#P'tmux pipe-pane -o writes everything a pane prints to a fileSaves all output of a tmux pane to a log file, switched on and off with one key.26 Nov 2026 - Tip
tmux has-session -t work 2>/dev/null || tmux new -d -s worktmux has-session tells a script whether a session already existsExits with success when the named session exists and with failure when it does not.21 Nov 2026 - Tip
Ctrl-b ?Ctrl-b ? shows every tmux key binding inside tmuxOpens a searchable list of all key bindings, including the ones you added yourself.21 Nov 2026 - Tip
Ctrl-b PageUpCtrl-b PageUp scrolls tmux back without any setupEnters scrollback straight away and moves one page up, with no mouse and no extra config.21 Nov 2026 - Tip
bind -r L resize-pane -R 5bind -r makes a tmux key repeat without pressing the prefix againLets you press a key several times after one prefix, which suits resizing and moving.21 Nov 2026 - Tip
Enter # copy and leave copy modeSpace starts a selection in tmux copy mode and Enter copies itSelects text in copy mode with the keyboard and copies it into tmux's paste buffer.21 Nov 2026 - Tip
Ctrl-b 0Ctrl-b and a digit jumps straight to that tmux windowSwitches to a window by its number, shown in the status bar, with two key presses.21 Nov 2026 - Tip
bind | split-window -hbind | and – to split tmux panes with keys that make senseReplaces the default split keys with a pipe for side by side and a dash for stacked.21 Nov 2026 - Tip
Ctrl-b ( # previous sessionCtrl-b ( and Ctrl-b ) switch between tmux sessionsMoves to the previous or next tmux session without detaching first.21 Nov 2026 - Tip
set -s escape-time 10set -s escape-time 10 stops the Escape lag in Vim inside tmuxCuts the delay tmux adds after Escape, so Vim and similar editors react at once.21 Nov 2026 - Tip
tmux join-pane -s 2 # take window 2 and put it into this windowtmux join-pane moves a pane from another window into this onePulls a pane out of another window and places it next to the pane you are in.21 Nov 2026 - Tip
Ctrl-b Alt-1 # even-horizontalCtrl-b Alt-1 to Alt-5 pick one tmux pane layout directlyApplies a fixed pane layout straight away, with the number of the layout as the key.21 Nov 2026 - Tip
set -g mode-keys viset -g mode-keys vi gives tmux copy mode vi keysMakes copy mode use vi movement and selection keys instead of the emacs style ones.21 Nov 2026 - Tip
setw -g monitor-activity onsetw -g monitor-activity on flags tmux windows that print somethingMarks a window in the status bar when something new appears in it while you look elsewhere.21 Nov 2026 - Tip
Ctrl-b SpaceCtrl-b Space cycles through the tmux pane layoutsRearranges the panes of the current window into the next of tmux's five built-in layouts.21 Nov 2026 - Tip
Ctrl-b n # next windowCtrl-b n and Ctrl-b p walk through your tmux windowsMoves to the next or the previous window in the session with a single key after the prefix.21 Nov 2026 - Tip
Ctrl-b ,Ctrl-b , renames the tmux window you are inGives the current tmux window a name you choose, so the status bar tells you what is running where.21 Nov 2026 - Tip
tmux attach -d -t worktmux attach -d takes over a session from another screenAttaches to a session and disconnects every other client that is still attached to it.21 Nov 2026 - Tip
set -g prefix C-aset -g prefix C-a moves the tmux prefix to a closer keyChanges the tmux prefix key from Ctrl-b to Ctrl-a, which is easier to reach.21 Nov 2026 - Tip
Ctrl-b =Ctrl-b = lists the last things you copied in tmuxShows every paste buffer tmux holds, so you can paste an older copy instead of the newest.21 Nov 2026 - Tip
Ctrl-b sCtrl-b s lists your tmux sessions and lets you pick oneOpens a list of all sessions to choose from, with a live preview of each.21 Nov 2026 - Tip
Ctrl-b :Ctrl-b : opens the tmux command prompt for any tmux commandLets you run any tmux command from inside tmux, without leaving the session.21 Nov 2026 - Tip
set -g default-terminal "tmux-256color"set -g default-terminal tmux-256color fixes broken colours in tmuxTells programs inside tmux the right terminal type, so colours and keys work as expected.21 Nov 2026 - Tip
Ctrl-b dCtrl-b d detaches from tmux and leaves everything runningLeaves the tmux session without stopping anything in it, so you can come back later.21 Nov 2026 - Tip
tmux display-message -p '#S' # session nametmux display-message -p prints facts like the session namePrints a tmux format such as the session name or pane path to the terminal, for use in scripts.21 Nov 2026 - Tip
Ctrl-b xCtrl-b x closes the tmux pane you are in, after a confirmationCloses only the current pane, asking first, and leaves the rest of the window alone.21 Nov 2026 - Tip
Ctrl-b &Ctrl-b & closes a whole tmux window after one confirmationCloses the current tmux window and every pane in it, but asks first.21 Nov 2026 - Tip
Ctrl-b ;Ctrl-b ; jumps back to the tmux pane you used beforeToggles between the current pane and the one you were in just before.21 Nov 2026 - Tip
tmux capture-pane -p -S - | grep -n 'error'tmux capture-pane -p dumps the pane's text to stdoutPrints everything in a tmux pane, scrollback included, so you can grep it.2 Oct 2026 - Tip
tmux list-keys -T prefix | grep split-windowtmux list-keys | grep finds the binding you forgotSearches all tmux key bindings from the shell, including the ones you added yourself.29 Sep 2026 - Tip
set -g renumber-windows onset -g renumber-windows on closes the gap when you close a windowRenumbers tmux windows automatically so there is no gap after one is closed.25 Sep 2026 - Tip
tmux new -As worktmux new -As work attaches to a session or creates itAttaches to the tmux session called work, or creates it when it does not exist.24 Sep 2026 - Tip
Ctrl-b Ctrl-Left # 1 cellCtrl-b Alt-arrow resizes a tmux pane five cells at a timeResizes the active tmux pane in steps of five cells with the Alt and arrow keys.22 Sep 2026 - Tip
Ctrl-b l # last windowCtrl-b l jumps back to the window you were just inToggles between the current and the previous tmux window, like alt-tab for windows.18 Sep 2026 - Tip
set -g status-position topset -g status-position top moves the tmux status bar to the topPuts the tmux status bar at the top of the screen instead of the bottom.14 Sep 2026 - Tip
select-layout tiledTmux select-layout tidies a mess of panes in one commandRearranges all panes in a tmux window into an even grid or evenly sized rows.7 Sep 2026 - Tip
tmux capture-pane -p -S -3000 > build.logtmux capture-pane -p dumps a pane's scrollback to a fileSaves what a tmux pane shows, including its history, to a text file or the terminal.30 Aug 2026 - Tip
/error # search forward for 'error'In tmux copy mode, / searches forward and ? searches backwardFinds text in a tmux pane's scrollback after Ctrl-b [, with n for the next match.27 Aug 2026 - Tip
Ctrl-b w # sessions and windowsCtrl-b w shows every window of every session as a treeOpens a list of all tmux sessions and windows with a preview, so you can jump to any of them.23 Aug 2026 - Tip
Ctrl-b $Ctrl-b $ renames the tmux session you are inGives the current tmux session a clearer name without restarting it.19 Aug 2026 - Tip
tmux kill-session -a -t worktmux kill-session -a closes every session except the one you nameKills all tmux sessions apart from the one you keep, for a quick clean-up.15 Aug 2026 - Tip
setw synchronize-panes onsetw synchronize-panes on types into every pane at onceSends everything you type to all panes in the tmux window, handy for the same command on several servers.12 Aug 2026 - Tip
set -g base-index 1set -g base-index 1 makes window numbers match the keyboard rowStarts numbering tmux windows at 1, so the first window sits under the 1 key.8 Aug 2026 - Tip
bind | split-window -h -c "#{pane_current_path}"Open new tmux panes in the folder you are already inMakes tmux splits and new windows start in the current pane's directory instead of your home folder.4 Aug 2026 - Tip
bind r source-file ~/.tmux.conf \; display-message "Reloaded"bind r to reload your tmux config without restarting anythingAdds a key that re-reads ~/.tmux.conf inside a running tmux session.1 Aug 2026 - Tip
set -g history-limit 50000set -g history-limit 50000 gives every pane a much longer scrollbackRaises how many lines each tmux pane remembers, so long output is still there when you scroll back.28 Jul 2026 - Tip
set -g mouse onset -g mouse on lets you click panes, drag borders and scrollTurns on mouse support in tmux, so clicking selects panes and the wheel scrolls the history.24 Jul 2026 - Tip
Ctrl-b qCtrl-b q numbers your panes so you can jump to one with a digitShows a big number on every tmux pane for a moment, and pressing a digit selects that pane.21 Jul 2026 - Tip
Ctrl-b { # swap with the previous paneCtrl-b { and Ctrl-b } swap the active pane with its neighbourMoves the active tmux pane one place up or down in the layout without closing anything.17 Jul 2026 - Tip
Ctrl-b !Ctrl-b ! turns a cramped pane into a window of its ownMoves the active tmux pane out of the split layout into a new window.13 Jul 2026 - Tip
Ctrl-b zCtrl-b z zooms one pane to the whole window and brings the others backMakes the active tmux pane fill the whole window, and a second press restores the layout.9 Jul 2026 - Tip
tmux ls -F '#{session_name}: #{session_windows} windows'tmux ls -F prints sessions the way a script wants themLists tmux sessions in a format you choose, for example only the name and window count.6 Jul 2026 - Tip
tmux new -As worktmux new -As work attaches to a session or creates it, one command for bothAttaches to the tmux session you name, or creates it when it does not exist yet.2 Jul 2026
Other tips3
- Tip
tmux wait-for build-donetmux wait-for blocks a script until another pane sends a signalPauses a command until something in another pane says it's done, without polling or sleep.2 Dec 2026 - Tip
set-hook -g after-split-window "select-layout even-vertical"Tmux set-hook runs a command after an event such as a splitRuns a tmux command automatically whenever an event such as a pane split happens.28 Nov 2026 - Tip
tmux display-popup -E -w 80% -h 80% htoptmux display-popup opens a floating window over your panesOpens a temporary floating window in tmux for a quick command, without touching your layout.25 Nov 2026
Storage2
- Tip
tmux new-window -d -n sync 'rsync -a ~/photos/ /mnt/backup/photos/'tmux new-window -d opens a window without switching to itStarts a command in a new window while you stay where you are.30 Nov 2026 - Tip
tmux new -d -s backup 'rsync -a /source/ /target/'tmux new -d -s job 'command' runs a command in the background that survives logoutStarts a command in a detached tmux session, so it keeps running after you log out.10 Sep 2026
Docker1
Nothing matches.