• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

How to Use Tmux: The Complete Guide

Bhagwad Park

Published on: June 11, 2025

Categories: Linux Command Line, VPS Hosting 0

In Linux, Tmux stands for “Terminal Multiplexer”, and we use it to run multiple commands from a single SSH session. Using tmux, we can have several windows open at the same time, running different tasks, and borrow some of the useful multi-tasking features from Windows. We’d written an earlier article on the basics of using tmux, but this one will go a bit deeper into the weeds.

There’s also another command-line tool called “screen,” which was very popular, but tmux is now preferred because it has a more modern interface, is easier to use, and is easier to configure, among other things.

Table of Contents
  • Installing tmux
  • Opening Two Windows using tmux
    • Splitting a tmux Window
  • Detaching and Re-attaching to a tmux Terminal
    • Listing all tmux Sessions
    • Re-attaching to a tmux Session
  • How tmux Differs from screen
  • Conclusion

Installing tmux

The default availability of tmux varies depending on the distribution of Linux and the preconfigured options. On NameHero, the VPS server comes installed with tmux, but you might not find it automatically on other systems. Here’s how to install tmux on various Linux distros:

  1. Ubuntu/Debian: sudo apt install tmux
  2. Fedora/Red Hat: sudo dnf install tmux

Once you’ve installed tmux, here’s how to use it.

Opening Two Windows using tmux

To quickly give you an idea of how to use tmux, I’m going to show you how to display two panes side by side. To start with, let’s create a new tmux session:

tmux new -s demo

This creates a new tmux session called “demo”. The “-s” parameter specifies that you want to create a named session. You can also create a throw-away unnamed instance of tmux using:

tmux

or

tmux new

These commands will create a new tmux session using an auto-generated name. If you’re working with tmux regularly, it’s a good idea to get used to naming your sessions so that you don’t get lost.

Running the above-named tmux creation command will give me this:

Tmux Screen
Tmux Screen

As you can see, this opens a new tmux window. Unlike a regular bash terminal, this one is named, as you can see below – we’ve given it the name “demo”, and it also gives the name of the creator as well as the time and date at which it was created.

Splitting a tmux Window

Now we can “split” the above window using the command:

Ctrl+b then %

The above command will create a vertical split in tmux and present you with two panes side by side as shown here:

Side by Side Panes with Tmux
Side by Side Panes with Tmux

If you want, you can also split the window horizontally, instead of vertically, using:

ctrl+b then "

To move between these panes, you type:

ctrl+b followed by an arrow key

Ctrl+b is the keyboard shortcut instructing tmux that you’re about to enter a command that affects tmux. Using the navigation keys, you can now run two separate sessions in each pane like this:

Running two Panes Side by Side
Running two Panes Side by Side

In this example, I’ve run the command “top” in the left-hand pane, and am doing my regular work in the right-hand pane. You can see how useful this might be, to have a continuously running command on one side so you can keep an eye on it, while going about your regular work in another pane. This way, you won’t have to constantly interrupt yourself to check the output of a command – you can just glance at the other pane – in this case, you can check and see if any particular process is misbehaving.

Detaching and Re-attaching to a tmux Terminal

While tmux is useful for displaying panes side-by-side, the real power comes from our ability to detach from these panes and reconnect them at a later date. This is super useful when executing long-running commands. Let’s say you have some backup command, and you want to ensure that it remains running even if you disconnect. You can use tmux to survive disconnections and pick up where you left off.

Of course, you can use the nohup command to survive disconnection, but nohup lacks many features that make tmux more useful. We’ll talk about tmux alternatives like nohup and screen below, but now let’s see how we can detach from a tmux session and re-attach.

To disconnect from a tmux session, type:

ctrl+b then d

This will return you to your shell prompt as shown here:

Detaching from a Session
Detaching from a Session

As you can see, it gives you the name of the session from which you detached – in this case, “demo” – and you can continue working on other stuff. In the meantime, the tmux session still exists in the background, and processing is still going on.

Listing all tmux Sessions

You can see the list of existing tmux sessions with the following command:

tmux ls

This gives the following output:

Listing the tmux Windows
Listing the tmux Windows

As you can see, tmux gives us the details of which sessions are currently running. The line starts with the name of the session – here “demo” – and tells us how many windows there are in the session, and when it was created.

In the time I took to write this article, I exited my SSH session and resumed it two days later. And when I returned, the tmux session was still going on in the background:

Tmux Running Two Days Later
Tmux Running Two Days Later

As you can see, today’s date is two days after the tmux session was created, and it’s still going! This shows you that it will continue running until you shut it down.

Re-attaching to a tmux Session

With “tmux ls”, you can get the names of all running tmux sessions. When you want to re-attach to one of them, you use the command:

tmux attach -t demo

And this will bring you back to the tmux session where you left off, like this:

Resumed tmux Session Two Days Later
Resumed tmux Session Two Days Later

As you can see, it’s the same. The screen hasn’t been cleared, and the “top” command is still running. I’ve included today’s date as the most recent command, so you can see that it’s today.

And that’s the basic usage of tmux. You can see that you can break up your work over multiple sessions, disconnect from SSH (even accidentally), and you won’t lose your work. It’s probably a good idea to always work within a tmux session in case you get disconnected for some reason, and you end up with a mess because of a broken workflow.

How tmux Differs from screen

A popular package similar to tmux is “screen”. Tmux was actually created as a replacement for screen, which was created in 1987, 19 years before tmux came along. Both tmux and screen serve similar purposes, but tmux has many more features than screen, and is easier to use. But since screen has such a history, many admins continue to use it. Here’s why tmux is better than screen, though.

In terms of workflow, tmux has panes, which makes working in side-by-side sessions much easier. With tmux, you can also script the creation of a repeatable dev workflow, so that you can start working ASAP with your preferred setup. Tmux also lets you restore panes and sessions in ways that screen simply can’t.

In short, if you have no experience with either tmux or screen, then I strongly suggest you start with tmux, since you’ll have an easier time working with it, and can take advantage of the easier and more intuitive workflow.

Conclusion

Tmux is a replacement tool for the older “screen” package, which allows you to disconnect from an SSH session and get back to where you left off. Using tmux, you can create side-by-side panes that act like “tabs”, and also separate windows – all of which can be restored after a disconnection.

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Related Posts

How to Use Git Rebase Interactive to Manage Commits

As a project progresses, commits can get messy. The git rebase interactive feature allows you to keep a clean commit history.

How to Use sed to Replace Strings in Files

The "Stream Editor" tool - the "sed" command in Linux, is often used to replace strings in files. Here's how to do it.

Curl vs Wget: Choosing the Right Tool for the Job

Linux has two popular tools for getting data from third party websites. Here's the difference between curl and wget.

How to Use the Bash Select Loop in Linux

The bash select loop allows your Linux script to present a set of choices to the user as a menu. Here's how to use it.

Reader Interactions

Leave a Reply Cancel 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.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA