Skip to content

Instantly share code, notes, and snippets.

@puneetverma24
Created August 13, 2023 15:43
Show Gist options
  • Save puneetverma24/cb0aec3af4c9d924726aed41c59f3a7e to your computer and use it in GitHub Desktop.
Save puneetverma24/cb0aec3af4c9d924726aed41c59f3a7e to your computer and use it in GitHub Desktop.

Tmux Cheat Sheet

Tmux is a terminal multiplexer that enhances your command-line productivity by allowing you to manage multiple terminal sessions within a single window.

Basic Commands

  • Start a new session: tmux
  • List existing sessions: tmux list-sessions
  • Attach to a session: tmux attach-session -t session_name
  • Detach from session: Ctrl-b d

Window and Pane Management

  • Create a new window: Ctrl-b c
  • Switch between windows: Ctrl-b n (next), Ctrl-b p (previous)
  • Split current pane vertically: Ctrl-b %
  • Split current pane horizontally: Ctrl-b "
  • Close current pane: Ctrl-b x

Navigating and Resizing Panes

  • Navigate between panes: Ctrl-b arrow keys
  • Resize panes: Ctrl-b :, then resize-pane -U/D/L/R followed by a number

Copy Mode and Scrolling

  • Enter copy mode: Ctrl-b [ or Ctrl-b PgUp
  • Scroll using arrow keys or mouse
  • Exit copy mode: q

Renaming Windows and Panes

  • Rename current window: Ctrl-b ,
  • Rename current pane: Ctrl-b ,

Miscellaneous Shortcuts

  • Rename session: Ctrl-b $
  • Show time in status bar: Ctrl-b t
  • Reload configuration: Ctrl-b : source-file ~/.tmux.conf

Remote Sessions

  • Connect to remote session: ssh user@remote_host 'tmux attach-session -t session_name'
  • Detach from remote session: Ctrl-b d
  • Reattach to remote session: ssh user@remote_host 'tmux attach-session -t session_name'

Advanced Techniques

  • Tmuxinator: Tool for defining and managing Tmux sessions for specific projects.
  • Customization: Modify .tmux.conf in your home directory for custom key bindings and settings.

Resources

Remember, Tmux's power lies in exploration and practice. Have fun enhancing your terminal workflow with Tmux!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment