Tmux Cheat Sheet

Starting & Managing Sessions

  • Start a New Session: tmux
  • Start a Named Session: tmux new -s session_name
  • Detach from a Session:
    Press: Ctrl + b, then d
  • List All Sessions: tmux ls
  • Attach to a Session: tmux attach -t session_name
  • Kill a Session: tmux kill-session -t session_name
  • Kill All Sessions (tmux server): tmux kill-server

Window Management

  • Create a New Window:
    Press: Ctrl + b, then c
  • Switch to Next Window:
    Press: Ctrl + b, then n
  • Switch to Previous Window:
    Press: Ctrl + b, then p
  • List Windows:
    Press: Ctrl + b, then w
  • Rename Current Window:
    Press: Ctrl + b, then , (then type new name)

Pane Management

  • Split Window Vertically:
    Press: Ctrl + b, then "
  • Split Window Horizontally:
    Press: Ctrl + b, then %
  • Switch Between Panes:
    Press: Ctrl + b, then o
    or use the arrow keys: Ctrl + b, then ←/β†’/↑/↓
  • Resize Panes:
    Enter command mode: Ctrl + b, then :
    Then type: resize-pane -L 10 # Resize left by 10 cells resize-pane -R 10 # Resize right by 10 cells resize-pane -U 5 # Resize up by 5 cells resize-pane -D 5 # Resize down by 5 cells
  • Close Current Pane:
    Type exit or press Ctrl + d

Copy & Paste Mode

  • Enter Copy Mode:
    Press: Ctrl + b, then [
  • Scroll Through History:
    Use arrow keys or Page Up/Down
  • Start Selection (in vi mode):
    Press Space to begin selection, then Enter to copy
  • Paste Copied Text:
    Press: Ctrl + b, then ]
  • View All Key Bindings:
    Press: Ctrl + b, then ?

Customization (via ~/.tmux.conf)

Add these lines to your ~/.tmux.conf to customize your experience:

# Change the prefix key from Ctrl+b to Ctrl+a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Enable mouse mode for pane selection and window resizing
set -g mouse on

# Use vi keys in copy mode
setw -g mode-keys vi
  • Reload Configuration Without Restarting Tmux: tmux source-file ~/.tmux.conf

This cheat sheet covers the basics and should serve as a quick reference to improve your workflow when using Tmux. Enjoy your enhanced terminal productivity!

πŸš€ Join the DevOps Dojo! 🌟

Are you passionate about growth, learning, and collaboration in the world of DevOps? The DevOps Dojo is your new home! Whether you’re just starting out or looking to refine your skills, this vibrant community is here to support your journey.

πŸ”§ What You’ll Get:

  • Access to expert-led discussions
  • Hands-on learning opportunities
  • Networking with like-minded professionals

Ready to take your DevOps game to the next level? Click below to learn more and join the community!

πŸ‘‰ Join the DevOps Dojo Today

Let’s build, grow, and thrive together! 🌐

Leave a Comment