tmux stands for terminal multiplexer. In short, this means you can open multiple terminal windows from one shell. The beauty of tmux shells is they automatically persist in the background allowing you to return to them at a later date and pick up exactly where you left off. You can leave programs running inside tmux and not worry about them stopping due to the user logging out. In addition, you can open multiple panes side-by-side allowing for greatly increased multitasking. This short document will provide you with the resources you need to start using tmux.
To start a tmux session you can type the command 'tmux' in your terminal or specify a session name with the 'new' command and '-s' flag:
$ tmux
$ tmux new -s <session name>
If you do not include a session name one will be provided for you, this will be a number assigned in numerical order of creation.
Once in tmux you will see a terminal which will act just like normal. To open new terminal pane use the 'prefix key' followed by either the '%' or double quote key ' " '. By default the 'prefix key' is assigned to 'ctrl + b'.
ctrl + b + % -> split window vertically
ctrl + b + " -> split window horizontally
Now that you have multiple panes you can navigate between them by pressing the 'prefix key' followed by the arrow key indicating direction
ctrl + b + right arrow -> moves a pane to the right
ctrl + b + up arrow -> moves up a pane
You can also create multiple windows inside of tmux using the 'c' key:
ctrl + b + c -> create a new window
You can kill panes and windows with the following:
ctrl + b + x -> kill current pane
ctrl + b + & -> kill current window
To exit tmux you can either kill the session or detach. Detaching will keep the session running in the background, so you can re-attach later.
ctrl + b + d -> detach
ctrl + b + :kill-session -> kills the current session
To re-attach to a session you can use any of the following:
$ tmux a -> this attaches to the most recent session
$ tmux a -t <session name> -> this attaches to the session specified by the session name
To list current sessions use:
$ tmux list-session
<coming soon>