Cheat Sheet :: Tmux
Working with Sessions
New Session
- Or you can use the shorthand
- If you’re already inside the
tmux
- Start a New Session with the name mysession
1
| tmux new -s mysession : new -s mysession
|
Kill/Delete Sessions
1
| tmux kill-session -t mysession
|
- Or you can use the shorthand
1
| tmux kill-ses -t mysession
|
- Kill/Delete all sessions but mysession
1
| tmux kill-session -a -t mysession
|
- Kill/Delete all sessions but the current session
Rename session
- If you’re already inside the
tmux
Move Between Sessions
- Move to Previous Session // If you’re already inside the
tmux
- Move to Next Session // If you’re already inside the
tmux
Attach to an Existing Session
Attach to the Last Session
- Or you can use the shorthand
Attach to an Existing Session with the Name mysession
1
| tmux attach-session -t mysession
|
1
| tmux attach -t mysession
|
- Or you can use the shorthand
Detach from Session
- If you’re already inside the
tmux
Show ALL sessions
- Or you can use the shorthand
- If you’re already inside the
tmux
Working with tmux Window
Start a new Window
- Start a new session with the name mysession and window name mywindow
1
| tmux new -s mysession -n mywindow
|
- Create a new Window // If you’re already inside the
tmux
Rename a Window
Moving Between Windows
Reorder a Window
- Swap window number 2 and 1
1
| : swap-window -s 2 -t 1
|
Working with Panes
Toggle Panes
Split the Pane
Moving Between Panes
- Move the current pane to the left
- Move the current pane t the right
Switching Between Panes
- Switch to pane to the direction
1
2
3
4
| Ctrl + b + Up
Ctrl + b + Down
Ctrl + b + Left
Ctrl + b + Right
|
Toggle synchronize-panes
- Send the same command to all panes
1
| : setw synchronize-panes
|
Toggle Between Panes
- Toggle between pane layouts
- Show pane numbers (Type the number to go to that pane)
Toggle the Pane Zoom
Convert a Pane into a Window
Resize the Pane
- Resize the current pane height
1
2
| Ctrl + b + Up
Ctrl + b + Down
|
- Resize the current pane width
1
2
| Ctrl + b + Left
Ctrl + b + Right
|
Close the Pane
Enter in Copy Mode (Buffer)
- Enter in Copy Mode and Scroll One Page Up
1
| Keyboard Up Cursor // Up
|
1
| Keyboard Down Cursor // Down
|
1
| Keyboard Left Cursor // Left
|
1
| Keyboard Right Cursor // Right
|
FIRST: Remember to Set the vim keys in Buffer Mode. Go to Set the runtime tmux Options section to learn more.
- Move Cursor Forward One Word At a Time
- Move Cursor Backward One Word At a Time
- Go to the Next Keyword Occurrence
- Go to the Previous Keyword Occurrence
Working with Buffers
- Paste the Contents of Buffer_0
- Display the Buffer_0 Contents
- Copy the Entire Visible Contents of Pane to a Buffer
- Show All Buffers and Paste Selected
- Save the Buffer Contents to the file
buf.txt
Set the runtime tmux Options
- Set OPTION for All Sessions
- Set OPTION for All Windows
- Set to use
vim keys in Buffer Mode
- Set the
vim Buffer Size in Runtime (history)
1
| set-option -g history-limit 50000
|
- Start a New Session with a Defined Buffer Size (history)
1
| tmux set-option -g history-limit 50000; new-session
|
Help
- Show Every Session, Window, Pane, etc…