Getting Started with tmux

Published: (March 15, 2026 at 07:09 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Introduction

An introduction to tmux, a terminal multiplexer.

Session Management

  • Start tmux

    tmux          # or
    tmux new-session
  • Create a new session within a session
    prefix + :new

  • List sessions

    tmux ls
  • Detach from a session (exit tmux)
    prefix + d

  • Attach to a session

    tmux attach      # or tmux a
  • Attach to a specific session

    tmux attach -t 0   # or tmux a -t 
  • Delete a session

    tmux kill-session
  • Delete a specific session

    tmux kill-session -t 0
  • Delete all sessions

    tmux kill-server
  • Rename a session
    prefix + $

Window Management

  • Create a new window
    prefix + c

  • Switch to the next window
    prefix + n

  • Switch to the previous window
    prefix + p

  • Switch to a specific window
    prefix + 0 (replace 0 with the window number)

  • List windows
    prefix + w

  • Delete a window
    prefix + &

Pane Management

  • Delete a pane
    prefix + x

  • Swap panes (forward)
    prefix + {

  • Swap panes (backward)
    prefix + }

Copy Mode

  • Enter copy mode
    prefix + [

  • Select copy range (in copy mode)
    v or Space

  • Copy (in copy mode)
    y or Enter

macOS Terminal Note

When using tmux in macOS Terminal, you cannot copy text by selecting it with the mouse (⌘+C) because tmux uses vim‑like shortcuts. To copy the selected range with the mouse, toggle the Terminal’s Allow mouse reporting setting with ⌘+R.

Configuration

The article references a tmux configuration repository:

github - bmf-san/dotfiles
0 views
Back to Blog

Related posts

Read more »

Getting Started with Gemini CLI

Introduction Google Cloud’s new weekly livestream series kicked off with a topic many developers and knowledge workers are curious about: Generative AI for the...