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 simultaneously in a single terminal window. This is particularly useful for working on servers, long-running tasks, or situations where you need to execute multiple tasks concurrently.

Common Tmux Shortcuts

  1. Create a new session: tmux new -s [session_name]
  2. Detach from a session: ctrl+b d
  3. Attach to a session: tmux a (attach) -t [session_name]
  4. Destroy a session: tmux kill-session -t [session_name]
  5. View session list in terminal environment: tmux ls
  6. View session list in session environment: ctrl+b s
  7. Create a window: ctrl+b c
  8. Switch between windows in the same session using the following shortcuts:
    • ctrl+b p (previous) - Switch to the previous window.
    • ctrl+b n (next) - Switch to the next window.
    • ctrl+b 0 - Switch to window 0, and so on for other window numbers.
    • ctrl+b w (windows) - List all windows in the current session, switch with up and down keys.
    • ctrl+b l (lowercase L) - Switch to adjacent windows.
  9. Close a window: ctrl+b &
  10. Vertical split: ctrl+b %
  11. Horizontal split: ctrl+b "
  12. Pane switching:
  • ctrl+b o - Cycle through panes in the current window.
  • ctrl+b Up|Down|Left|Right - Select and switch to a specific pane based on arrow direction.
  • ctrl+b Space - Rearrange layout of all panes in the current window, cycling through different styles.
  • ctrl+b z - Maximize the current pane; press again to restore.
  1. Close a pane: ctrl+b x
  2. Help: ctrl+b ?
  3. ctrl-b + shift-d: Choose to close a session; this command will list the login sessions for the current session. )

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