Tmux is a terminal multiplexer that lets you run multiple terminal sessions inside a single window. It allows you to split the terminal into different panes, create multiple windows, and switch between sessions. You can also keep your terminal sessions running in the background and reconnect to them later.
Here’s what you can do with Tmux in Termux:
- Create multiple terminal sessions.
- Split the terminal into horizontal and vertical panes.
- Open multiple terminal windows.
- Switch between different sessions.
- Run commands in the background.
- Detach and reattach terminal sessions.
- Manage multiple tasks in one terminal.
- Keep running processes active after closing the terminal session.
Install Tmux in Termux
Below is the command to install Tmux in Termux, just copy and run the command in your Termux.
Update and upgrade the packages:
pkg update && pkg upgrade -yInstall Tmux:
pkg install tmux -yOnce the installation is complete, Tmux is ready to use in your Termux terminal.
Use Tmux in Termux
Here are some basic Tmux commands to create and manage sessions, switch between windows, and control terminal panes. You can also use keyboard shortcuts to perform common tasks quickly.
Start a new Tmux session:
tmuxCreate a named session:
tmux new -s mysessionList all active sessions:
tmux lsDetach from the current session:
Press:
Ctrl + B, then DReattach to a session:
tmux attach -t mysessionKill a session:
tmux kill-session -t mysessionKill all Tmux sessions:
tmux kill-serverTmux Keyboard Shortcuts
Tmux uses Ctrl + B as its default prefix key. Press the prefix key first, then press the shortcut key.
Session and Window Commands:
Ctrl + B, thenD– Detach from the current session.Ctrl + B, thenC– Create a new window.Ctrl + B, thenN– Move to the next window.Ctrl + B, thenP– Move to the previous window.Ctrl + B, thenW– List available windows.Ctrl + B, then,– Rename the current window.Ctrl + B, then$– Rename the current session.
Pane Management Commands:
Ctrl + B, then%– Split the terminal vertically.Ctrl + B, then"– Split the terminal horizontally.Ctrl + B, then an arrow key – Move between panes.Ctrl + B, thenX– Close the current pane.Ctrl + B, thenZ– Zoom in or out of the current pane.Ctrl + B, thenO– Switch to the next pane.Ctrl + B, thenQ– Show pane numbers.
Other Useful Shortcuts:
Ctrl + B, then[– Enter copy mode to scroll through terminal output.Ctrl + B, then]– Paste copied text.Ctrl + B, then?– Show all keyboard shortcuts.
These commands and shortcuts help you manage multiple terminal sessions in Tmux. You can switch between windows, split panes, and control your sessions without opening multiple terminal windows.
End Note
Tmux is a useful tool for managing multiple terminal sessions in Termux. It allows you to split your screen, switch between windows, run multiple commands, and keep processes running in the background. It is especially useful when working with multiple terminal tasks at the same time.

