Getting Started with Tmux on Terminal
Tmux is a terminal multiplexer that allows you to run multiple terminal sessions within a single window. It is a powerful tool for anyone who spends significant time in the terminal, offering persistent sessions, multiple panes, and flexible session management. In this guide, we will cover how to install tmux, its basic and advanced commands, and provide references for further learning.
Table of Contents
- Introduction
- Installing Tmux Using apt
- Basic Tmux Commands
- Advanced Tmux Commands
- References
- Conclusion
Installing Tmux
Installing tmux on a Debian-based system (like Ubuntu) or WSL Terminal is straightforward using the apt
package manager.
Before installing tmux, ensure your package list is up to date.
sudo apt update
Then install tmux by running.
sudo apt install tmux
You can verify the installation by checking the version.
# upper case V
tmux -V
Basic Tmux Commands
Once tmux is installed, you can start exploring its basic features.
# starting a New Session
> tmux
# detaching from a Session
Ctrl+b, then d
# reattaching to a Session
> tmux attach
# creating a New Window
Ctrl+b, then c
# switching Between Windows
Ctrl+b, then n (for next window)
Ctrl+b, then p (for previous window)
Advanced Tmux Commands
Tmux's advanced features allow for more efficient and complex workflows.
# splitting Panes Horizontally
Ctrl+b, then "
# splitting Panes Vertically
Ctrl+b, then %
# resizing Panes
Ctrl+b, then arrow keys
# renaming a Session
> tmux rename-session -t [old-name] [new-name]
# list All Sessions
> tmux ls
# killing a Session
> tmux kill-session -t [session-name]
Cheatsheet
References
For more detailed information and advanced configurations, visit the official tmux page:
Conclusion
Tmux is an essential tool for anyone who works extensively in the terminal. From managing multiple sessions to splitting your terminal into panes, tmux provides the flexibility and efficiency needed for a productive command-line experience.
Happy Coding