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.

The image is a text description of features related to "tmux," highlighting its release year, client-server model, session management, key layouts, and terminal support.


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:

ComponentDescription
Host nameYour machine’s hostname
Time & dateCurrent timestamp
Session nameName of the active tmux session
Window indexNumeric index (starts at 0)
Window nameName of the window (usually the running program)
Active windowMarked 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).

ActionShortcut
Create new windowPrefix + c
Rename current windowPrefix + ,
List windows interactivelyPrefix + w
Next windowPrefix + n
Previous windowPrefix + p
Select window by numberPrefix + <number>
Kill current windowPrefix + & (confirm y/n)
Find window by namePrefix + f
Change window indexPrefix + . (period)

The image shows a tmux session with window management commands on the left and keyboard shortcuts on the right. The shortcuts include combinations for creating, renaming, and navigating windows.

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

ActionShortcut
Split horizontallyPrefix + "
Split verticallyPrefix + %
Kill current panePrefix + x (confirm y/n)
ActionShortcut
Move between panesPrefix + Arrow keys
Last active panePrefix + ;
Resize by 1 linePrefix + Ctrl + Arrow
Resize by 5 linesPrefix + Alt + Arrow

The image shows a list of keyboard shortcuts for managing panes in tmux, including moving between panes, moving to the last active pane, and resizing a pane by one line.

Swapping & Zooming Panes

ActionShortcut
Swap with previous panePrefix + {
Swap with next panePrefix + }
Toggle pane zoomPrefix + Z

The image shows keyboard shortcuts for managing panes in tmux, including swapping to previous and next panes, and zooming in/out of a panel.

Additional Pane Actions

ActionShortcut
Show a clockPrefix + t (press q to quit)
Break pane into new windowPrefix + !

Sessions

Control entire tmux sessions with these commands:

ActionCommand / Shortcut
List sessionstmux ls<br>or Prefix + s
Create new session (prompt)Prefix + : new
Rename sessionPrefix + $
Switch sessionsPrefix + s → select
Kill sessiontmux kill-session -t <name>
Attach to sessiontmux a
Detach from sessionPrefix + d
Detach specific clientPrefix + D
Refresh displayPrefix + r

Copy/Paste & Scrollback

To capture text from a pane:

  1. Enter copy mode: Prefix + [
  2. Navigate to the start point: Arrow keys
  3. Press Space to begin selection
  4. Move to the end point: Arrow keys
  5. Press Space to copy into tmux buffer
  6. Paste into any pane: Prefix + ]

The image is a guide for using tmux scrollback mode, showing keyboard shortcuts for entering scrollback mode, moving to text, and marking the beginning and end of a selection.


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

That’s it for this lesson. You can test your knowledge with the quiz.

Watch Video

Watch video content

Previous
GNU Screen