Tmux is a terminal multiplexer, this means it allows you to run several programs at once from the command line either in a single screen in ‘panes’ or in several tabs or ‘windows’. Making it incredibly easy to multitask or keep an eye on running systems. If you are using SSH to connect to a server you can keep programs running through disconnects.

Please note all the key combinations I have used are for a UK keyboard.

My usual Tmux configuration

My usual Tmux configuration. Clockwise from left: pane for working in, iftop network monitoring, htop system monitor

Most package managers have tmux in their repositories, but if you can’t find it a quick search online should find it.

To open tmux you type the command “tmux”.

Freshly opened Tmux

Freshly opened Tmux

For all non typed commands you use a prefix which is by default ‘ctrl-b’, then press the button/s for the command

To split this pane vertically use the prefix then ‘%’ (shift-5).

Tmux with 2 panes

Tmux split into 2 vertical panes

To split the currently active pane horizontally use ‘”‘ (shift-2).

Tmux with 3 panes

Tmux with 3 panes

 

To change between active panes use ‘o’. You can run any program in a pane and use the other panes at the same time, allowing you to keep an eye on, htop or any other running programs.

If you want to remove a pane use ‘x’.

To connect to an already running session usetmux attach

Another part are windows, windows or tabs is another screen which can be broken up into panes.

Windows are useful if you want to do a large amount of editing or need more screen real estate.

To switch windows use ‘p’.

For creating a new window use ‘c’.

To name a window to make it easier to find, use ‘,’

Use ‘&’ to kill a window

To disconnect from a session but keep it running in the background use ‘d’

To reattach type ‘tmux attach’

These are some of the basic commands to get you going in Tmux but there are loads more for more complex usage.

Here are some good cheat sheets that I regularly reference, but there are loads more if you search google.

MohamedAlaa’s cheat sheet

andreyvit’s cheat sheet

Comments

comments