Cool Cmd #7 – tmux

Print Friendly, PDF & Email

This Post is based on the detailed article on Terminal Multiplexers by William Shot here:

Want a more convenient way to access multiple sessions remotely than separate PuTTY windows?

If you are one of these folks that like having lots of info going on in one terminal, then linux is great for that as we all know, as it is possible to have multi-panels open on a desktop at once, and switch between them as required, as can Apples with the Ctrl <> commands etc.

You may want to (1) run htop, while needing to (2) write a file with vim and (3) check user activity with w and (4) follow the PC changes in real time using

tail -F /var/log/syslog

and not want to keep clicking between Windows "windows" if you are not actually at your linux box in person.

What about a remote SSH session? Well, normally you would just open up multiple SSH sessions too, say from your Win laptop using PuTTY etc. but you can also use screen or its later variation – tmux – and split only one SSH session window with more than one cmd line session in the SAME single SSH session.

This method probably reduces overall network and machine overheads on a limited bandwidth link too, as all the linux PC data is sent maximally (as the PC processes are serial in nature anyway) over the one SSH session instead of 3 or 4 separate ones.

Command Description
Ctrl-b " Split pane horizontally
Ctrl-b % Split pane vertically
Ctrl-b arrow Move to adjoining pane
Ctrl-b Ctrl-arrow Resize pane by 1 character
Ctrl-b Alt-arrow Resize pane by 5 characters
Ctrl-b x Destroy current pane

You can split the window vertically or horizontally, then move between them using Ctrl b <> or Ctrl b ^ v arrows with tmux.

You can keep splitting windows vertically or horizontally but lose half the available space each time.

The digital clock can be viewed with Ctrl b then t.

Just to overdo the example:

Ctrl-b "Split pane horizontally
Ctrl-b %Split pane vertically
Ctrl-b arrowMove to adjoining pane
Ctrl-b Ctrl-arrowResize pane by 1 character
Ctrl-b Alt-arrowResize pane by 5 characters
Ctrl-b xDestroy current pane y/n


You can remove the clock by moving to its window and pressing Return.

Read Will Shots article for more ideas – I just wanted to highlight this cool option as it is very handy for me and the way I write Posts – in Win Word for the formatting and ease of screenshots, and uploading to WordPress, whilst accessing the Linux Mint box cmd line via PuTTY and/or tightvncserver to show what I'm writing about, and access my network shares between all PCs.

This now makes all that a little easier, especially copying and pasting highlighted command lines between screens and documents.

It reminds me of Multitail that I used some time back that can combine watching many files/processes happening at the same time in the same panel or separate panels e.g.

multitail /var/log/apache2/access.log -I /var/log/apache2/error.log

Read the man page for tmux, as usual with any new cmd:

man tmux