Tmux install and quickly start

Tmux is a terminal multiplexer that can run multiple programs in one terminal. There is powerful to manage several programs in the remote server in one terminal, and using the session to attach or detach them. A prefix is an advanced tool that supports split windows and quick short keys.

That’s getting the start for how to using tmux. Here will showing common usage about tmux.

Install Tmux in Mac, Ubuntu, CentOS

Install tmux in mac

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew update
brew install tmux

Install tmux in ubuntu

sudo apt install tmux

Install tmux in centOS

sudo yum install tmux 

List Tmux Session

List all tmux session

tmux ls

Create Tmux Session

Create session (session name will auto-generate)

tmux

Create a session by name

tmux new -s {session name}

# like this
tmux new -s adam01

Detach Session

Detach session (just leave not kill)

tmux detach

Re-Attach session

Re-attach session

tmux attach -t {session name}

Kill Tmux session

kill tmux session

tmux kill-session -t {session name}

kill all tmux session

tmux kill-session -a

Prefix control

Tmux prefix is ctrl + b ,When press <prefix> , have more shortcut key can be used.

Split verticlly windows: <prefix> + "

Split horizontally windows: <prefix> + %

Move between windows: <prefix> +

Close winodws: exit or <prefix> + x

Switch widnow arrange: <prefix> + space

detach session: <prefix> + d

Switch to previous session: <prefix> + (

Switch to next session: <prefix> + )