Tmux is "Terminal Multiplexer"

Introduction

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

Installation

# Ubuntu/Debian
sudo apt install tmux

# MacOS
brew install tmux

Basic Commands

Session

  • tmux - Start a new session
  • exit - Exit the session
  • tmux new -s <session-name> - Start a new session with a name
  • tmux ls or tmux list-session - List all sessions
  • tmux attach -t <session-name> - Attach to a session
  • tmux detach - Detach from a session
  • tmux switch -t <session-name> - Switch to a session
  • tmux rename-session -t <old-name> <new-name> - Rename a session
  • tmux kill-session -t <session-name> - Kill a session
  • tmux kill-server - Kill all sessions

Window

  • tmux split-window [-v] - Split the window vertically
  • tmux split-window -h - Split the window horizontally
  • tmux select-pane -U/D/L/R - Select the pane up/down/left/right

Shortcuts

Most shortcuts start with prefix key Ctrl+B, then press the following key.

Session

  • Ctrl+D - Exit the session
  • Ctrl+B D - Detach from a session
  • Ctrl+B S - Switch to a session
  • Ctrl+B $ - Rename a session

Window

  • Ctrl+B " - Split the window vertically
  • Ctrl+B % - Split the window horizontally
  • Ctrl+B ↑/↓/←/→ - Select the pane up/down/left/right
  • Ctrl+B { - Move the current pane to the left
  • Ctrl+B } - Move the current pane to the right
  • Ctrl+B Ctrl+o - Move the current pane to the up
  • Ctrl+B Alt+o - Move the current pane to the down
  • Ctrl+B x - Close the current pane
  • Ctrl+B ! - Break the current pane into a new window
  • Ctrl+B z - Zoom in/out the current pane
  • Ctrl+B Ctrl+↑/↓/←/→ - Resize the pane up/down/left/right
  • Ctrl+B Q - Show pane numbers

References

版权声明: 如无特别声明,本文版权归 Longbin's Tech-Blog 所有,转载请注明本文链接。

(采用 CC BY-NC-SA 4.0 许可协议进行授权)

本文标题:《 Tmux Basic Commands 》

本文链接:https://longbin.tech//linux/Tmux-Basic-Commands.html

本文最后一次更新为 天前,文章中的某些内容可能已过时!