What is it?
Tmux is a terminal multiplexer, which is a program that allow you to run more than one program in terminal, detached them and reattach them later e.g
Running tmux on a server, you have your favorite editor open doing works.
Somehow the internet went, your connect to the server dropped.
Login back to the server and reattach the same tmux session.
Everything you were editing will be exactly as before the connection dropped.
This continuity is hugh productivity boost, imaging you can always have your work environment setup the way you specified and it doesn’t matter which computer and where you work from.
Tmux is the morden version of screen, but with morden code base, easy configuration and plugins!
Setting it up is really simple, just install it using Operating system’s package manager
Once its install, just need to run it
It will start a new shell inside a new window in a new tmux session, tmux will start a new session after invoke tmux command, within the session, you can have many windows (think tabs), then you can sub divide the window into different pane.
In this tmux session, there are 3 windows as indicated at the middle of bottom screen (this is the status line - it can be customised), there are two panes within the current window - a vim and bash shell at the bottom.
One of the most useful thing about tmux is its configuration is very easy to understand, and it offer tons options - see the .tmux.conf session for more information
By default tmux use C-b as prefix key - you have to press ctrol and b, then with other keys for the command.
I found that its easier to use C-a (ctrl + a) instead, because that’s the prefix key for screen which I have used before tmux (hard to change a habit!).
Here are some useful keys:
C-a d - Dettach the current session
C-a , - Rename the current window
C-a Z - Zoom the current pane and hide other panes within the window
C-a & - Kill the current window too.
C-a s - Show all available tmux sessions on the machine, very useful to switch between different tmux session or project setups
C-a : - Open the tmux command line, you can issue command from here
C-a c - Open a new window
C-a “ - Split the current window with horizontal pane
C-a % - Split the current window with vertical pane
Configuration - .tmux.conf
This is the name of the config file, it should be live inside your home directory - its a hidde file (~/.tmux.conf)
All customisation is specified in here