Tmux Quick Start

What’s tmux?

Tmux is a "terminal multiplexer", it enables a number of terminals (or windows) to be accessed and controlled from a single terminal. It allows you to create a session on a remote box, run applications in that remote session, "detach" from the session, and re-"attach" when desired. It also has advanced features such as multiple windows and split views. Using tmux is recommend when running an interactive CLI program remotely. If you get disconnected from your session, you can re-attach as though nothing happened.

Why tmux?

Tmux lets you run tasks persistently on remote box, so you can safely disconnect/detach and reconnect/reattach without interrupting these running tasks. It is powerful, extensible and can save more working time when combined with the shortcuts.

Installation

Most platforms provide binary packages for tmux. Use the command below to install from binary.


# Debian, Ubuntu
$ sudo apt-get install tmux

# RHEL/CentOS/Fedora
$ sudo yum install tmux

# MacOS
$ brew install tmux
                    

If you need the latest version, use the commands below to install from source.


git clone https://github.com/tmux/tmux.git
cd tmux
sh autogen.sh
./configure && make
                    

First Tmux Session

Now that you've completed the installation, type tmux to start the first session:


tmux
                    

Split your pane horizontally by typing:

Ctrl+b then %

Swhich pane by typing:

Ctrl+b then

Ctrl+b then

Detach/Exit session:

Ctrl+b then d

Attach to last session:


tmux a
                    

Now feel free to experiment with the cheat sheet in home page. If you find any missing shortcut, please let me know :D