SPICE | Tmux Guide - UMCST/SPICE-user-info GitHub Wiki
What is it?
Tmux is a terminal multiplexer; it allows you to create several "pseudo terminals" from a single terminal. This is very useful for running multiple programs with a single connection, such as when you're remotely connecting to a machine using SSH.
Tmux also decouples your programs from the main terminal, protecting them from accidental disconnecting. You can detach tmux from the current terminal, and all your programs will continue to run safely in the background. Later, you can reattach tmux to the same or a different terminal.
How do you use it?
Tmux uses many keyboard shortcuts that are triggered by pressing the "prefix" combination which by default is Ctrl+B. Going forward $
represents a normal command while :
represents inside a tmux session using the prefix combination followed by the :
and the rest of the command.
Sessions
To start a new session
$ tmux
which is short for $ tmux new-session
or :new
To start a new session with a name
$ tmux new -s <name of session>
or :new -s <name of session>
Kill/Delete session with name
$ tmux kill-ses -t <name of session>
which is short for $ tmux kill-session -t <name of session>
Kill/Delete all sessions but the current
$ tmux kill-ses -a
Kill/Delete sessions but
$ tmux kill-ses -a -t <name of session>
Rename Session
Ctrl
+ b
then $
Detach from session
Ctrl
+ b
then d
Detach others from the session
:attach -d
Show all sessions
$ tmux ls
or tmux list-sessions
Ctrl
+ b
then s
Attach to last session
$ tmux a
or $ tmux attach-session
Attach to session with
$ tmux a -t <name of session>
or $ tmux attach-session -t <name of session>
Session and Window Preiew
Ctrl
+ b
then w
Move to previous session
Ctrl
+ b
then (
Move to next session
Ctrl
+ b
then )
Panes
Toggle last active pane
Ctrl
+ b
then ;
Split pane with horizontal layout
Ctrl
+ b
then %
Split pane with vertical layout
Ctrl
+ b
then "
Close current pane
Ctrl
+ b
then x
Toggle synchronize-panes (send command to all panes)
:setw synchronize-panes
Switch to pane to the direction
Ctrl
+ b
then <up arrow>
Ctrl
+ b
then <down arrow>
Ctrl
+ b
then <left arrow>
Ctrl
+ b
then <right arrow>
Move the current pane left
Ctrl
+ b
then {
Move the current pane right
Ctrl
+ b
then }