Follow these steps to install and use tmux:
Step 1: Install the terminal multiplexer from official Linux package sources using the install package command: apt-get install tmux
With Debian or Ubuntu, you’ll have to use the “sudo” add-on: sudo apt-get install tmux
Step 2: Start tmux by typing “tmux” into the terminal. When tmux starts, you’ll see a status display on the bottom of the window consisting of the host name (username@host-server), the time and the date. On the bottom left, you’ll see the name of the session (if named) and the number of windows in the following format “[0] 0:bash*”. The first window is named “0”. If there is a process running in the window, it is displayed after the 0 (e.g., “0:bash*”).
Step 3: Control tmux by using commands and keyboard shortcuts. Initiate each command or keyboard shortcut with [Ctrl] + [B] or, when configuring panes, [Ctrl] + [B] + [:] to get tmux’s attention.
Step 4: Start a new named session by using the command “tmux new -s”. After “-s”, enter the desired name of the session. If you want to start a session without a session name, simply type “tmux”.
Step 5: To end a session, enter the command “exit” or use the keyboard shortcut [Ctrl] + [D].
Step 6: To open a new window in the session, press [C]. To start a second session in parallel with the first, use the command “tmux new -s [session name].” again. The status display underneath shows which session you are currently in.
Step 7: If you want to divide a window into panes, press [%] for a vertically divided window or ["] for a horizontally divided window. Use the arrow keys to navigate between the panes.
Step 8: If you want to detach a running session but keep processes running, use the “tmux detach” command. The session and the running processes will continue to run in the background. To resume the session, use the “tmux attach” command to reconnect.