Tmux is a Terminal Multiplexer
Tmux consists of Sessions, Windows and Panes

Session is the top most layer in Tmux and manages one or more Windows At a time we can only attack to a single session
Each session has a single active Window

Windows are containers to one or more Panes Windows are like tabs in browsers. Each Window has an active Pane

In Tmux all commands are prefixed by an hotkey (Default: Ctrl + b)

Tmux Cheat Sheet & Quick Reference

Session Management

List Sessions

tmux ls
s # When in tmux

Attach/ Detach Session

tmux a -t <session-no/session-name>
 
# Attack to recent session
tmux a
 
# Detach from current session
d

Create Session

tmux
tmux new -s <session-name> # Named session
 
# From within Tmux
:new

Rename Session

tmux rename-session -t <session-no> <new-session-name>
 
# Rename the current session
$

Move between Session

( & ): Move between Sessions

Killing Session

# Kill specific session
tmux kill-session -t <session-no>
 
# Kill all Tmux Sessions
tmux kill-server

Windows

c: New Window
,: Rename Window
&: Close Window
w: List Windows

n: Next
p: Previous
0-9: Move

Swapping Windows

:swap-window -s 2 -t 1

Panes

Split Window

% (Horizontal)
" (Vertical)

Move between Panes

Arrow Keys: Move between panes
q: Flash Pane Number
q 0-9: Move to Pane
o: Next Pane

Arrange/ Resize Panes

Space: Different Layouts
Ctrl + Arrow Key: Resize pane
z: Zoom & Unzoom
{ & }: Swap Panes

Copy Text

Space - Arrows - Enter

Space starts copy process
Arrow to select chunk of text
Enter to copy selected text

Closing Pane

x: Close current pane
exit: Close Pane
Ctrl + d: Kill Pane

Pane to Window

!: Turn Pane to new Window