tmux Commands

After 13 years of using GNU Screen now moving to tmux.

install tmux in the centos 7 Linux

( from https://centos.pkgs.org/7/ius-x86_64/tmux2u-2.5-1.ius.centos7.x86_64.rpm.html )

rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm    
yum install tmux2u

To start the tmux session first time

tmux -L work

I use below snippt to create the tmux session

#!/bin/bash
tmux has-session -t work
if [ $? != 0 ]; then
    tmux new-session -s work -n kube -d
    tmux send-keys -t work 'ssh k8sm-01' C-m
    tmux split-window -h -t work
    tmux send-keys -t work:1.2 'ssh k8sn-01' C-m
    tmux split-window -v -t work
    tmux send-keys -t work:1.3 'ssh k8sn-02' C-m
    tmux new-window -n console -t work
    tmux send-keys -t work:2 'cd;pwd' C-m
    tmux select-window -t work:1.1
fi
tmux attach -t work

Send command to mulitple windows

Press the control key

setw synchronize-panes on

If you type anything in one pane, same command will run on other pane also.

To Disable syn-pan

setw synchronize-panes off    

Copyright © 2004, Software Groups