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
- Create a new session:
tmux new -s [session_name]
- Detach from a session:
ctrl+b d
- Attach to a session:
tmux a (attach) -t [session_name]
- Destroy a session:
tmux kill-session -t [session_name]
- View session list in terminal environment:
tmux ls
- View session list in session environment:
ctrl+b s
- Create a window:
ctrl+b c
- 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.
- Close a window:
ctrl+b &
- Vertical split:
ctrl+b %
- Horizontal split:
ctrl+b "
- 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.
- Close a pane:
ctrl+b x
- Help:
ctrl+b ?
ctrl-b + shift-d
: Choose to close a session; this command will list the login sessions for the current session.