Beginner's Tmux Guide

A beginner-friendly guide to start using tmux effectively. Learn how to install, configure, and use tmux's essential features to enhance your terminal workflow.

What is Tmux?

Tmux is a terminal multiplexer that enhances your terminal experience by allowing you to:

  • Run multiple terminal sessions in a single window
  • Detach from and reattach to terminal sessions without losing your work
  • Split your terminal into multiple panes for enhanced productivity
  • Create multiple windows (like tabs) within a session

"Once you start using tmux, you'll wonder how you ever lived without it. - alvin"

terminal

user@tmuxai:~$tmux

# Session 0: Terminal divided into multiple panes
Pane 0
$ vim app.js
Pane 1
$ npm run dev
Pane 2
$ git status

Key Concepts

Sessions
Windows
Panes
Prefix Key

Independent workspaces that can be detached from and reattached to without losing your work. Great for long-running tasks.

Installation

Installing tmux is straightforward on most systems. Select your operating system below:

macOS Installation Options

Using Homebrew (Recommended)

Install tmux with Homebrew package manager:

# Install Homebrew if you don't have it
brew install tmux

Using MacPorts

If you use MacPorts:

sudo port install tmux

Tmux Guide

A tmux session contains windows (like tabs) and each window contains panes (split views).

1. Sessions

The top-level container in tmux. Think of a session as a workspace that persists even when you disconnect.

Click for details

2. Windows

Similar to tabs in a browser. Each window takes up the full terminal view within a session.

Click for details

3. Panes

Split views within a window. Allows you to see multiple terminal instances simultaneously.

Click for details
tmux
user@tmuxai:~$

Key Commands

  • tmux new-session -s nameCreate a new named session
  • Ctrl+b dDetach from current session
  • tmux attach -t nameReattach to a session
  • tmux lsList all sessions