Tmux
Tmux is a terminal multiplexer which means it is used to manage multiple terminal sessions. Tmux allows you to spawn several sessions and reattach/detach from them. With tmux, you can run multiple programs in the terminal and run these in the background.
Vocabulary
A tmux Windows takes up the entire terminal Window it was spawned in. Every Window has a name (by default, this name is an index number). Windows do not have to be unique. The session identifies them. A Window consists of 1+ panes, and therefore we can view more than one pane at once.
A tmux Pane appears in one Window (Get it? Windowpane). Panes can cover the entire Window. Each pane contains a border. One pane in each Window is called the active pane, which is the pane the user is currently operating and sending commands. You can easily toggle between panes, changing the active pane as you navigate. You can manipulate the sizes and positions of panes within a window.
A Session can have more than one Window but has one current Window. Sessions can be started programs running. The user can detach from a session and navigate to a new session or work in the original terminal Window. Tmux will still run these programs in the background, allowing the user to attach whenever they need to without disrupting any running programs.
Sessions
New Sessions
tmux
tmux new
tmux new-session
tmux new-session -s <session_name>
List Sessions
tmux ls
tmux list sessions
[ctrl+b][s]
Attach/Detach Sessions
tmux a
tmux attach-session -t <session_name>
tmux a -t <session_name>
[ctrl+b
][d
] detach session
[ctrl+b
][)
] next session
[ctrl+b
][(
] previous session
[ctrl+b
][$
] rename session
Remove Sessions
tmux kill-sess
tmux kill-session -t <session_name>
Windows
[ctrl+b][c]
create window
[ctrl+b][']
select window by name
[ctrl+b][.]
change window number
[ctrl+b][,]
rename window
[ctrl+b][0]..[9]
move to last used window
[ctrl+b][f]
search windows
[ctrl+b][n]
move to next window
[ctrl+b][p]
move to the previous window
[ctrl+b][l]
move to last used window
Panes/Moving Around
[ctrl+b][%]
split pane vertically
[ctrl+b]["]
split pane horizontally
[ctrl+b][arrow_up]
move up to the pane
[ctrl+b][arrow_down]
move down to pane
[ctrl+b][arrow_left]
move to the left pane
[ctrl+b][arrow_right]
move to the right pane
[ctrl+b][{]
move pane left
[ctrl+b][}]
move pane right
[ctrl+b][x]
kill pane
Misc
[ctrl+b][[]
scroll up or down - [q]
to quit scroll mode