Reorder windows in tmux

To reorder windows in tmux, you can use following command CTRL + B + . Press CTRL + B or whatever prefix you use, then press . (dot). This will ask you number/position where you need current window moved. Another method is CTRL + B + : This will give you tmux command promt. Now … Read more

run same command on multiple tmux panes

If you want to run same command on multiple servers, you can use tmux synchronize-panes feature. This will be useful when you need to setup multiple servers, say install nginx/php/mysql on multiple servers. You can create multiple panes in tmux. SSH into each of the servers from these panes. Now run CTRL + B : … Read more

tmux create new window on current directory

When you start a new window or split pane on tmux, it always start with the directory from where you run tmux command. I prefer it start with current working directory of active tmux window. To do this, edit file vi ~/.tmux.conf Add bind c new-window -c “#{pane_current_path}” bind ‘”‘ split-window -c “#{pane_current_path}” bind % … Read more

Auto Attach to tmux session on SSH

To start tmux and attach to existing connection on SSH in, edit file vi ~/.bashrc Add if [[ “$TMUX” == “” ]] && [[ “$SSH_CONNECTION” != “” ]] && [ “$SSH_TTY” != “” ]; then WHOAMI=$(whoami) if tmux has-session -t $WHOAMI 2>/dev/null; then tmux -2 attach-session -t $WHOAMI else tmux -2 new-session -s $WHOAMI fi … Read more

SSH Agent forwarding with tmux

Most of the time i connect to remote virtial machine to SSH to other servers. This way i will always have a fixed IP, so i can white list my IP in firewall. I use tmux on this server, so even if i get disconnected, my connection to these servers won’t get disconnected. This is … Read more

Install tmux on CentOS 6

tmux is a terminal emulator. It work like screen, but have more features. CentOS 6 do not come with tmux, you need to enable rpmforge repository. http://repoforge.org/use/ On CentOS 6 64 bit, run rpm -ivh http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm yum install tmux

tmux

To attach to a specific session, run tmux a -t SESSION_ID CTRL+B % Split window vertically CTRL+B “ Split window horizontally CTRL+B c Create new window CTRL+B d Detach tmux session CTRL+B $ Rename session CTRL+B n Next window. CTRL+B p Previous window. CTRL+B arrow keys switch between panes. .tmux.conf .tmux.conf file is used to … Read more