惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Jina AI
Jina AI
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
I
InfoQ
L
LangChain Blog
The Cloudflare Blog
IT之家
IT之家
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
博客园 - 聂微东
美团技术团队
博客园_首页

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
tmux: Persistent Terminal Sessions for Developers
Sysemperor · 2026-05-19 · via DEV Community

I lost three hours of work to a dropped SSH connection before I learned about tmux. One detached session later and that problem stopped existing entirely. If you spend any meaningful time on remote servers, tmux is the single highest-leverage tool you can add to your workflow.

Two things make it worth learning: sessions survive after you close your terminal or lose an SSH connection — your processes keep running and you reconnect to find everything exactly where you left it. And you can split a single terminal into multiple panes and windows without juggling tabs.


Install

# Debian / Ubuntu
sudo apt install tmux

# RHEL / Fedora / Rocky
sudo dnf install tmux

# macOS
brew install tmux

Enter fullscreen mode Exit fullscreen mode


Core concepts

tmux has three levels:

  • Session — a collection of windows. One session per project is the natural fit.
  • Window — a full-screen view inside a session. Think of it like a browser tab.
  • Pane — a split region within a window. One window can hold several panes.

The prefix key is how you send commands to tmux without the keystrokes going to the program running inside it. The default is Ctrl+B. Press it, release, then press the command key.


Start and attach to sessions

Create a new named session:

tmux new -s myproject

Enter fullscreen mode Exit fullscreen mode

Detach (session keeps running in the background):

Ctrl+B  d

Enter fullscreen mode Exit fullscreen mode

List sessions:

tmux ls

Enter fullscreen mode Exit fullscreen mode

Reattach by name:

tmux attach -t myproject

Enter fullscreen mode Exit fullscreen mode

Short form: tmux a -t myproject. With only one session, tmux a is enough.

Kill a session:

tmux kill-session -t myproject

Enter fullscreen mode Exit fullscreen mode


Windows

Action Keys
New window Ctrl+B c
Next window Ctrl+B n
Previous window Ctrl+B p
Go to window by number Ctrl+B 0–9
Rename current window Ctrl+B ,
Close current window Ctrl+B &

Windows appear in the status bar at the bottom. The active one has a * next to its name.


Panes

Action Keys
Split top/bottom Ctrl+B "
Split left/right Ctrl+B %
Move between panes Ctrl+B arrow keys
Resize pane Ctrl+B Ctrl+arrow keys
Zoom to full screen Ctrl+B z (toggle)
Close current pane Ctrl+B x

Zoom is one of the most useful shortcuts — it temporarily expands a pane to fill the entire window without closing the others. Hit it again to return to the split view.


Scrollback and copy mode

Mouse scroll does not work inside tmux by default. To scroll:

Ctrl+B  [

Enter fullscreen mode Exit fullscreen mode

This enters copy mode. Arrow keys and Page Up/Page Down navigate. Press / to search, n for the next match, q to exit.


Auto-start a session on login

tmux sessions do not survive a reboot. For development machines where you always want a session waiting:

# add to ~/.bashrc or ~/.zshrc
if [ -z "$TMUX" ]; then
  tmux attach -t main 2>/dev/null || tmux new -s main
fi

Enter fullscreen mode Exit fullscreen mode

The [ -z "$TMUX" ] guard prevents tmux from launching inside an existing tmux session, which would nest them.


~/.tmux.conf

A minimal config that most people find immediately useful:

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

# Enable mouse: click to focus panes, drag to resize
set -g mouse on

# Increase scrollback
set -g history-limit 10000

# Status bar: show session name on the left, time on the right
set -g status-left "[#S] "
set -g status-right "%H:%M"

Enter fullscreen mode Exit fullscreen mode

Reload the config without restarting:

Ctrl+B  :source-file ~/.tmux.conf

Enter fullscreen mode Exit fullscreen mode

Mouse support is the single option worth enabling immediately if you are used to a GUI terminal. It makes pane navigation and resizing click-based while you build up the keyboard shortcuts.


Found this useful? SysEmperor has more Linux tutorials and free developer tools — including a Cron Visual Editor, fstab Editor, and a growing library of downloadable AI skills at sysemperor.com.