Tmux

Tmux - Terminal multilplexer

Tmux allows you to have multiple Windows, sessions , split -windows etc. on a single terminal, which could be useful while having a single ssh session. You could run a build on window, and perform editing in other window.

Installation

On ubuntu flavors, tmux is installed via 'apt' utility
 sudo apt install tmux  

Create a new window 

Current window is marked with an asterisk(*) at the bottom
 ctrl+b then 'c'  

Navigate between windows

For previous window
 ctrl+b then 'p'  
For next window
 ctrl+b then 'n'  

Scroll in a window

Enter scrolling mode
 ctrl+b then '['  
Keys for scrolling
 up/down arrow or pgup/pgdown  
Quit scrolling mode
 q  

Split a window vertically

 ctrl+b then '%'  

Split a window horizontally

 ctrl+b then '"'  

Navigate between tabs internally in a window

 ctrl+b then 'up/down/left/right keys'  

Adjust size of a split window

 ctrl+b then 'esc' then 'up/down or left/right keys'  
It's step size controlled - meaning when you execute this command the window size gets changed once per execution of this command. If you want modify the size further, execute the command once again

Clear the contents of Window/pane

You will have to bind a key to do this functionality. This has to be done in ~/.tmux.conf. Add the below line in ~/tmux.conf.
 bind k send-keys -R \; send-keys C-l \; clear-history  
Now you can clear the contents via the command
 ctrl+b then 'k'  
Check this stack overflow link and this blog for more info.

Open new window/pane from the PWD

Add the below lines to ~/.tmux.conf. These commands, rebind the keys to open new window/pane from the PWD.
 bind '"' split-window -c "#{pane_current_path}"  
 bind % split-window -h -c "#{pane_current_path}"  
 bind c new-window -c "#{pane_current_path}"  

Refer this stack overflow link for more info.

Set the scroll buffer size

Add the below line to ~/.tmux.conf. This will set the scroll buffer size.
 set-option -g history-limit 50000  

Refer this stack overflow link for more info.

Tmux logging

This feature will log the activities on a tmux panel. Refer https://github.com/tmux-plugins/tmux-logging for more info

Comments

Popular Posts