Tmux : split your terminal into multiple screens
Tmux stands for multiplexer.We can split our terminal into several terminals and control,access from a single screen.
Tmux is a must know tool guys ever since i started using this i cant imagine my workflow with Tmux now.
Tmux creates a new session when you start it.Tmux lets you switch easily between several screens in one terminal.You can detach running applications and send to the background.But we can always reattach when we need tem again.
A session is a single collection of multiple terminals under the management of tmux. Each session has one or more windows linked to it. A window occupies the entire screen and can be split into rectangular panes.
Now let's jump to the practicals .Open your terminal
When you hit enter nothing fancy happens but if you observe carefully. At the bottom there is line with some green background showing username and date.Now we can start using tmux.
Create panes or split with Tmux
It gets a little tricky here.
Control+b and %
Press control+b first then shift+5 on your successful completion you will see that your screen will be splitted into 2 parts vertically.
Split screen horizontally
Use below combination to split terminal horizontally.Control+b first then double quotation mark. You can create as many as tmuxes you want.
Control+b and ".
Control+b first then press double quotation.Your screen will be splitted horizontally.
There are couple of ways to exit Tmux terminal first on is exit command.
Tmux's way of exiting is by entering :
control+b and x
At the bottom to will be asked to confirm your exiting.So go ahead and press y.
Switch between panes Tmux
You can switch between your panes easily :
Control+b and use your arrow keys to switch to the different panes left,right and bottom wherever you want.
Resizing Tmux panes.
Resizing panes is easy just a little different than switching.
Control+b and arrow keys but here you have to hold Control+b and then press arrow keys.
Defualt setting of tmux are bit annoying like splitting screen with ctr+b can be annoying.We can actually customize tmux setting according to our comfort.We will configure tmux to make things easier.In order to do this we have to make a configuration file.Tmux does not make configuration file himself but it checks at the start if configuration file exist or not.If it finds any then it loads in. So our first step is to make a file.
Open your terminal and create a file with .tmux.conf write the following command:
root@seven:~# touch .tmux.conf
When you create a file with dot at the beginning it creates a hidden file.The above touch command creates an empty text file in your home directory.it does not do anything for now so now open your .tmux.conf file in a text editor.
root@seven:~# leafpad .tmux.conf
Now copy and paste the following line into your .tmux.conf file save and exit.
# changing prefix from control+b to control+a unbind C-b set-option -g prefix C-a bind-key C-a send-prefix #use alt+arrow keys to switch between panes bind -n M-Reft select-pane -L bind -n M-Right select-pane -R bind -n M-Up select-pane -U bind -n M-Down select-pane -d
Everything is very self explanatory in the above lines.In the first configuration your default setting for splitting control+b will be changed to control+a.Guys you can assign whatever character you want.
With the second configuration now we can switch between panes with alt+arrows.
Now restart the system and it's done.
These are very basic configurations that i created .This is a just a way to get started with tmux and it's configurations.Will be making more tutorials on tmux soon.Do share if it helped you thanks.