Tmux is a terminal multiplexer. It allows you to run and manage several command prompts simultaneously from one tmux session.
Tmux uses a client/server model, which allows it to persist connections. You can start a session from one computer, run several programs running in it, and then disconnect. You can later reconnect to the same session from a different computer and the same programs will be running.
On Debian and Ubuntu systems, install tmux with apt.
$ sudo apt-get update && sudo apt-get -y install tmux
On Redhat, CentOS, and other RHEL-based systems, install tmux with yum.
$ sudo yum install update && sudo yum -y install tmux
$ tmux new -s start
You will see a bar at the bottom of the screen with the session name tmux created, start, in brackets. This is because Tmux automatically logs in with your user account when it creates new panes.
Once inside a tmux session, you use a prefix key to trigger commands to tell tmux what to do. The default prefix key is CTRL + B. For example, if you want to tell tmux to create a new pane by splitting your screen into two vertical sections, you first type CTRL + B, then %.
If you typed CTRL + B, then % as shown above, then you have two panes on your screen.
Create a third window with CTRL + B, then C.
You will see a new blank terminal again.
Issue the command
tmux list-windows, then press ENTER to confirm that you have three windows opened.
tmux attach -t YOUR_SESSION_NAME.
tmux list-sessions- List existing tmux sessions.
tmux new -s session-name- Create a new tmux session named session-name.
tmux attach -t session-name- Connect to an existing tmux session named session-name.
tmux switch -t session-name- Switches to an existing tmux session named session-name.