9 Tmux
9.1 Introduction
Tmux, short for terminal multiplexer, is a powerful command-line tool that enables users to manage multiple terminal sessions from a single window. It’s particularly useful for remote work, allowing you to create, detach, and reattach to terminal sessions, keeping your work preserved even after disconnection. Tmux enhances productivity and workflow by providing features like window splitting, session management, and customizable key-bindings, making it an indispensable tool for developers, system administrators, and power users who require robust terminal management.
9.2 Installation
# Installation
apt-get install tmux
# Launch
tmux
9.3 Basic Commands
Press ctrl + b then:
c
: Create a new terminal in the active tmux sessionn
: Switch between different terminals in the sessiond
: Detach from the tmux session,
: Rename a terminalt
: Display the time in a terminalz
: Close the tmux sessionw
: Select a terminal interactively
Commands in a Split (press Control + b first)
%
: Vertical split of the current terminal into two + open a terminal in the new panel"
: Horizontal split of the current terminal into two + open a terminal in the new panelo
: Switch between split terminalsspace
: Change the visual arrangement of split terminalsAlt
+ (arrow keys): Resize split window!
: Convert a split into a standalone terminalq
: Display numbers of split terminals:join
: Join a standalone terminal into a split Example to add terminal number 3 vertically and for it to take up 50% of the total space::joinp -v -s 3.0 -p 50
-h
or-v
: horizontally or vertically-s 0.0
: terminal 0 and pane 0 (pane if screen split)-p 50
: occupy 50% of the window
Commands to type in a standard terminal
tmux
: Create a sessiontmux attach
: Reattach to the last used sessiontmux ls
: See the list of active tmux sessionstmux attach -t X
: Attach to a tmux session where X is the session number