Skip to content

Instantly share code, notes, and snippets.

@kennyng
Last active February 21, 2024 14:25
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kennyng/816c29eb75e8eb022108 to your computer and use it in GitHub Desktop.
Save kennyng/816c29eb75e8eb022108 to your computer and use it in GitHub Desktop.
tmux Commands Reference

tmux Commands Reference


Table of Contents


GENERAL

  • tmux info
    • lists out every session, window, pane, pid, etc.
  • tmux list-keys
    • lists out every bound key and the command it runs)
  • .tmux list-commands
    • lists out every tmux command and its arguments
  • tmux source-file ~/.tmux.conf (<Ctrl-f> + r)
    • reloads the current tmux configuration
  • tmux source-file ~/.tmux/python-dev (<Ctrl-f> + P)
    • custom command to load python session layout
  • <Ctrl-f> + <Ctrl-k> (kill server, including all sessions)
  • <Ctrl-f> + ? (get help)
  • <Ctrl-f> + [ (enter Copy mode)
    • <SPACE> (select contents to copy)
    • <ENTER> (copy contents to paste buffer)
    • v (toggle visual/visual-block select)
    • q (exit Copy mode)
  • <Ctrl-f> + ] (paste contents from buffer)

SESSION MANAGEMENT

  • tmux new [-s session-name]
    • creates a new tmux session named 'session-name'
  • tmux list-sessions (<Ctrl-f> + s)
    • lists existing tmux sessions
  • tmux attach [-t session-name]
    • attaches to an existing session named 'session-name' (otherwise the top session)
  • tmux switch [-t session-name]
    • switches to an existing session named 'session-name' (otherwise the top session)
  • tmux kill-session [-t session-name]
    • kill existing session named 'session-name'
  • tmux detach
    • detach the currently attached session
  • tmux rename-session [-t current-name] [new-name] (<Ctrl-f> + $)
    • renames the current session

WINDOWS (TABS) MANAGEMENT

  • tmux new-window (<Ctrl-f> + c)
    • create a new window
  • tmux split-window (<Ctrl-f> + \)
    • split the current window vertically
  • tmux split-window -h (<Ctrl-f> + -)
    • split the current window horizontally
  • tmux select-window [-t 0-9] (<Ctrl-f> + [0-9])
    • switch to the window as specified by index
  • tmux find-window [window-name] (<Ctrl-f> + f)
    • find the window given by 'window-name'
  • tmux rename-window (<Ctrl-f> + ,)
    • rename the current window
  • <Ctrl-f> + <Ctrl-f> (toggle last window)
  • <Ctrl-f> + n (switch to the next window)
  • <Ctrl-f> + p (switch to the previous window)
  • <Ctrl-f> + w (list all windows)
  • <Ctrl-f> + & (kill the current window)

PANE MANAGEMENT

  • <Ctrl-f> + o (toggle between panes)
  • <Ctrl-f> + q (show pane numbers; enter number to go to pane)
  • <Ctrl-f> + [hjkl] (switch to the pane in the specified direction)
  • <Ctrl-f> + [HJKL] (resize the pane in the specified direction)
  • <Ctrl-f> + } (swap with the next pane)
  • <Ctrl-f> + _{ (swap with the previous pane)
  • <Ctrl-f> + x (kill the current pane)
  • <Ctrl-f> + ! (break the current pane out of the window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment