Back
Featured image of post Common Tmux Commands

Common Tmux Commands

Introducing commonly used shortcuts in Tmux for easy reference.

Introduction to Tmux

tmux is a terminal multiplexer that allows you to run multiple terminal sessions within a single terminal window. It’s extremely useful when working on servers, running long processes, or when you need to handle multiple tasks simultaneously.

Common Tmux Shortcuts

  1. Create a new session: tmux new -s [session_name]

  2. Detach from the current session: Ctrl + b, then d

  3. Reattach to a session: tmux attach -t [session_name]

  4. Kill a session: tmux kill-session -t [session_name]

  5. List all sessions in the terminal: tmux ls

  6. List all sessions within a Tmux session: Ctrl + b, then s

  7. Create a new window: Ctrl + b, then c

  8. Switch between windows: Use the following shortcuts to move between windows in the same session:

    • Ctrl + b, then p (previous) to switch to the previous window.
    • Ctrl + b, then n (next) to switch to the next window.
    • Ctrl + b, then 0 (or any window number) to switch to that specific window.
    • Ctrl + b, then w (windows) to list all windows in the current session and switch using the arrow keys.
    • Ctrl + b, then l to switch to the last window you were on.
  9. Close the current window: Ctrl + b, then &

  10. Vertical split: Ctrl + b, then %

  11. Horizontal split: Ctrl + b, then "

  12. Switch panes:

    • Ctrl + b, then o to cycle through panes in the current window.
    • Ctrl + b, then arrow keys (, , , ) to move to a specific pane.
    • Ctrl + b, then Space to rearrange panes with each press.
    • Ctrl + b, then z to maximize the current pane. Press again to restore.
  13. Close the current pane: Ctrl + b, then x

  14. Help menu: Ctrl + b, then ?

  15. Choose a session to kill: Ctrl + b, then Shift + d to list active sessions and choose one to terminate.

Licensed under CC BY-NC-SA 4.0
Last updated on 2024-09-10 10:59 +0800
Built with Hugo | Theme Stack designed by Jimmy