For those who do not know what tmux is, but somehow ended up in this page, tmux is terminal multiplexer which allows you to:

  • Leave terminal sessions and come back without interrupting the running process. On a remote computer, you can run some long installation process in tmux, go offline, and come back later to see the results, so you'll have the live terminal output.
  • Allow you to manage a whole bunch of screens, split displays, dashboards at once, organized in three layers as sessions, windows, and panes. You can maneuver many terminal screens with simple shortcuts and manipulate your workspace with scripts and hotkeys.

So, let's go to the commonly used commands:

List sessions

tmux ls

start new session

tmux

start new named session

tmux new -s sessionName

attach to named session

tmux a -t sessionName

kill session

tmux kill-session -t sessionName

kill all tmux sessions

tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill

detach

ctrl+shif+b and then press d

For more detailed list of commands including those for tabs and splits, check tmux cheetsheet on GitHub.