[tmux] installation – tarball and configuration

Linux Command & Tools

Previously, I was a screen user, it helped me to open multiple sessions and windows to manage lots of Linux servers.

But, its window split feature is not pretty friendly, so, that’s why I started using tmux.


tmux gitrepo – https://github.com/tmux/tmux

tmux packages – https://github.com/tmux/tmux/releases ( you may download favorite version here )


My OS is RHEL-7, first we have to install required packages

# For RHEL6 you could install
# yum install libevent2-devel ncurses-devel glibc-static -y

$ yum install libevent-devel ncurses-devel glibc-static -y

then, download tmux tarball package and install it, I choose 2.4 version here.

$ wget https://github.com/tmux/tmux/releases/download/2.4/tmux-2.4.tar.gz

$ tar -zxvf tmux-2.4.tar.gz

$ cd tmux-2.4

# I prefer to install manual tarball package under /opt/ directly.
$ ./configure --prefix /opt/tmux

$ make && sudo make install

# once installed, you would see tmux binary was installed under /opt/tmux/bin folder
$ ls /opt/tmux/bin/

Configure your PATH environment variable and alias

function t() {
  if [[ $# -ne 2 ]]; then
    tmux ls
    case $1 in
        # create a new session
        tmux new -s $2
        # attach an exist session
        tmux attach -t $2
        # kill a session
        tmux kill-session -t $2

export TMUXPATH="/opt/tmux/bin" 


$ tmux -V
tmux 2.4

Bind Key Configuration

When you execute tmux, it would load your customized configuration from ~/.tmux.conf

I’m using MAC, I loved to use “option” key as control key.

control keys code

  • M – option
  • C – control

# change prefix to OPTION key
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

# scrollback buffer n lines
set -g history-limit 200000

# option + q,w for switch window
bind-key -n M-q previous-window
bind-key -n M-w next-window

# option + c for create new window
bind-key -n M-c new-window

# option + h for split pane horizontally
bind-key -n M-v split-window -h
bind-key -n M-h split-window -v

# highlight selected window
set-window-option -g window-status-current-bg white

# option + d to detach client
bind-key -n M-d detach-client

# option + k to kill a pane
bind-key -n M-k kill-pane

Useful Default Short Key

default bind-key: https://gist.github.com/zchee/37b4795f735ed78600c9

Note: My prefix is C-a

  • zoom in ( full screen ) a pane : C-a + z 
    • when you want to leave this mode, you may C-a + z again, it is useful when you want to copy text from this pane
  • list session tree: C-a + s 
    • this is useful when you want to switch between session and window
  • tune pane size
    • vertical up expansion: C-a + M-Up
    • vertical down expansion: C-a + M-Down
    • horizontal left expansion: C-a + M-Left
    • horizontal right expansion: C-a + M-Right
  • switch pane
    • move left: C-a + Left
    • move right: C-a + Right
    • move up: C-a + Up
    • move down: C-a + Down
  • kill current pane: C-a + x


  • https://larrylu.blog/tmux-33a24e595fbc
  • https://liyang85.github.io/how-to-install-the-latest-stable-tmux-on-centos7.html
  • http://www.dayid.org/comp/tm.html
  • https://gist.github.com/shinzui/866897
Linux Command & Tools
OpenSSl Useful Commands

Check SSL Certificate dates # check site $ echo | openssl s_client -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -noout -dates # check file $  sudo openssl x509 -dates -noout -in ./server.crt $  sudo openssl x509 -dates -noout -in ./server.pem Check SSL Certificate expired # result 0 : not expired # …

Linux Command & Tools
[Linux Bash Shell] custom bind keys

Shell short keys : https://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html#Bindable-Readline-Commands https://ss64.com/bash/syntax-keyboard.html We can use bind command to set the short keys in Bash environment. dump short keys : $ bind -p set short keys from file $ bind -f {key map file} set short key directly $ bind '"\C-p": shell-backward-kill-word' How to know the key code …

Linux Command & Tools
[Linux Commands] How to listen a port via command line to handle http request

NC $ while true; do echo 'HTTP/1.1 200 OK' | nc -l 8080; sleep 0.5; done GET / HTTP/1.1 User-Agent: curl/7.33.0 Host: localhost:8080 Accept: */* $ curl http://localhost:8080 -v * Rebuilt URL to: http://localhost:8080/ * About to connect() to localhost port 8080 (#0) * Trying… * Adding handle: conn: …