Linux Professional Institute LPIC-1 Exam 101
GNU and Unix Commands
tmux
tmux is a powerful terminal multiplexer first released in 2007. It uses a client–server architecture to manage multiple terminal sessions from a single server process. Key enhancements over traditional tools include:
- Client–server model for centralized session management
- Multiple windows per session, with windows linkable across sessions
- Interactive menus for navigating sessions, windows, and clients
- Support for both Vim and Emacs key bindings
- Full UTF-8 and 256-color support
Note
Ensure your terminal emulator supports 256 colors and UTF-8 for the best tmux experience.
Starting tmux
To launch tmux with a default session:
$ tmux
This creates a new session containing one window. The status bar at the bottom displays:
Component | Description |
---|---|
Host name | Your machine’s hostname |
Time & date | Current timestamp |
Session name | Name of the active tmux session |
Window index | Numeric index (starts at 0) |
Window name | Name of the window (usually the running program) |
Active window | Marked with * |
To start tmux with a custom session and window name:
$ tmux new -s LPI -n "Window zero"
The status bar then shows:
[LPI] 0:Window zero*
Managing Windows
All tmux commands begin with the prefix key (default: Ctrl +b).
Action | Shortcut |
---|---|
Create new window | Prefix + c |
Rename current window | Prefix + , |
List windows interactively | Prefix + w |
Next window | Prefix + n |
Previous window | Prefix + p |
Select window by number | Prefix + <number> |
Kill current window | Prefix + & (confirm y/n) |
Find window by name | Prefix + f |
Change window index | Prefix + . (period) |
Warning
Killing a window will prompt for confirmation. Unsaved work inside that window will be lost upon confirmation.
Panes (Splits)
tmux splits windows into panes, each running as an independent pseudoterminal.
Splitting Panes
Action | Shortcut |
---|---|
Split horizontally | Prefix + " |
Split vertically | Prefix + % |
Kill current pane | Prefix + x (confirm y/n) |
Navigating & Resizing Panes
Action | Shortcut |
---|---|
Move between panes | Prefix + Arrow keys |
Last active pane | Prefix + ; |
Resize by 1 line | Prefix + Ctrl + Arrow |
Resize by 5 lines | Prefix + Alt + Arrow |
Swapping & Zooming Panes
Action | Shortcut |
---|---|
Swap with previous pane | Prefix + { |
Swap with next pane | Prefix + } |
Toggle pane zoom | Prefix + Z |
Additional Pane Actions
Action | Shortcut |
---|---|
Show a clock | Prefix + t (press q to quit) |
Break pane into new window | Prefix + ! |
Sessions
Control entire tmux sessions with these commands:
Action | Command / Shortcut |
---|---|
List sessions | tmux ls <br>or Prefix + s |
Create new session (prompt) | Prefix + : new |
Rename session | Prefix + $ |
Switch sessions | Prefix + s → select |
Kill session | tmux kill-session -t <name> |
Attach to session | tmux a |
Detach from session | Prefix + d |
Detach specific client | Prefix + D |
Refresh display | Prefix + r |
Copy/Paste & Scrollback
To capture text from a pane:
- Enter copy mode:
Prefix + [
- Navigate to the start point: Arrow keys
- Press Space to begin selection
- Move to the end point: Arrow keys
- Press Space to copy into tmux buffer
- Paste into any pane:
Prefix + ]
Configuration
tmux reads configuration from:
- System-wide:
/etc/tmux.conf
- User-specific:
~/.tmux.conf
To load a custom file at startup:
$ tmux -f ~/my-tmux.conf
Sample ~/.tmux.conf
:
# Change prefix to Ctrl-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Quick access to windows 10, 11, 12
bind F1 select-window -t :10
bind F2 select-window -t :11
bind F3 select-window -t :12
Note
Reload your tmux configuration without restarting by running:
Prefix + : source-file ~/.tmux.conf
For full command reference:
$ man tmux
Links and References
That’s it for this lesson. You can test your knowledge with the quiz.
Watch Video
Watch video content