Categories
Command Line Development Tools Linux

tmux: A Better Alternative to GNU Screen

I've been a long-time user of GNU Screen, and I've always recommended it to anyone working with remote servers. Screen is an excellent tool that's saved me countless times when SSH connections drop or I need to run long-running processes. But it has one major problem: it's tough to configure and learn.

Recently I discovered tmux, and I'm making the switch. If you're not familiar with terminal multiplexers or you're struggling with Screen's complexity, tmux might be exactly what you need.

What Are Terminal Multiplexers?

Terminal multiplexers let you run multiple terminal sessions inside a single window, and more importantly, they let sessions persist even when you disconnect. This is crucial for remote server work.

The typical scenario: you SSH into a server, start a long-running process, and your connection drops. Without a multiplexer, your process dies. With Screen or tmux, the session continues running on the server, and you can reconnect and pick up exactly where you left off.

Why tmux Over GNU Screen?

GNU Screen has been the standard for decades, and it's solid software. But it has rough edges:

  • Confusing default keybindingsCtrl-a conflicts with bash line navigation
  • Cryptic configuration – The .screenrc syntax is arcane
  • Steep learning curve – Basic operations require memorizing obscure commands
  • Limited split functionality – Splitting windows is awkward

tmux addresses all of these issues:

  • Better default prefixCtrl-b doesn't conflict with anything
  • Cleaner configuration.tmux.conf syntax is more intuitive
  • Easier to learn – Logical keybindings that make sense
  • Better splits – Vertical and horizontal splits work smoothly
  • Active development – tmux is actively maintained with new features

Installation

On Mac with Homebrew:

$ brew install tmux

On Ubuntu/Debian:

$ sudo apt-get install tmux

On other systems, tmux is likely in your package manager as well.

Basic Usage

Start tmux:

$ tmux

That's it. You're now in a tmux session. The status bar at the bottom shows you're in session 0, window 0.

Essential keybindings (all start with Ctrl-b):

  • Ctrl-b c – Create new window
  • Ctrl-b n – Next window
  • Ctrl-b p – Previous window
  • Ctrl-b d – Detach from session
  • Ctrl-b % – Split pane vertically
  • Ctrl-b " – Split pane horizontally
  • Ctrl-b arrow – Navigate between panes

Reattach to a session:

$ tmux attach

If you have multiple sessions, list them with tmux ls and attach to a specific one with tmux attach -t <session-name>.

Configuration

Create ~/.tmux.conf for your settings. Here's a useful starting configuration:

# Enable mouse support (helpful when starting out)
set -g mouse on

# Improve colors
set -g default-terminal "screen-256color"

# Set scrollback buffer
set -g history-limit 10000

# Start window numbering at 1 instead of 0
set -g base-index 1

After creating or editing .tmux.conf, reload it inside tmux with:

Ctrl-b :source-file ~/.tmux.conf

Practical Use Cases

Remote server management – SSH into a server, start tmux, run your processes. If your connection drops, just SSH back in and tmux attach.

Long-running tasks – Start a deployment, database migration, or backup inside tmux. Detach and do other work. Check back later.

Development workflow – One pane for your editor, one for running the app, one for logs, one for a shell. All visible at once.

Pair programming – Multiple users can attach to the same tmux session and see the same screen. Everyone sees what everyone else types in real-time.

Getting More Advanced

This should be enough to get you started. For a comprehensive keybinding reference, check out this tmux cheat sheet.

As you get comfortable, explore splitting panes, creating named sessions, customizing the status bar, and setting up complex layouts. tmux is powerful once you know the basics. Last modified: 2011-07-12 WordPress ID: 897

By Shishir Sharma

Shishir Sharma is a Software Engineering Leader, husband, and father based in Ottawa, Canada. A hacker and biker at heart, and has built a career as a visionary mentor and relentless problem solver.

With a leadership pedigree that includes LinkedIn, Shopify, and Zoom, Shishir excels at scaling high-impact teams and systems. He possesses a native-level mastery of JavaScript, Ruby, Python, PHP, and C/C++, moving seamlessly between modern web stacks and low-level architecture.

A dedicated member of the tech community, he serves as a moderator at LUG-Jaipur. When he’s not leading engineering teams or exploring new technologies, you’ll find him on the open road on his bike, catching an action movie, or immersed in high-stakes FPS games.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.