• 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 Exit Tmux: The Complete Guide

Benjamin O'Donald

Published on: February 7, 2025

Categories: Linux Command Line 0

Linux Administrators at times will need to open multiple terminal sessions while logged into a server in order to multi-task between different projects/tasks.

Many Linux users are familiar with the ‘screen’ command line utility to accomplish this but in newer versions of RHEL and other distributions we are seeing Tmux becoming more popular in the “terminal-multiplexer” department.

Table of Contents
  • What is Tmux?
  • Features of the Tmux utility
  • How to create a Tmux session
  • How to name and open a new Tmux session
  • How to rename an existing Tmux session
    • 1. List all existing Tmux sessions
    • 2. Rename the Tmux session
  • How to attach to an existing Tmux session
    • 1. List current sessions of Tmux
    • 2. Re-attach to a Tmux session
  • How to exit Tmux sessions
  • How to kill sessions of Tmux
  • How to install Tmux on different operating systems
    • Mac OS Tmux install (using homebrew)
    • RHEL or Rocky Linux Tmux install
    • Fedora Tmux install
    • Ubuntu Tmux install
  • Conclusion

What is Tmux?

Tmux is a useful tool which allows a user to open multiple terminal sessions all within 1 window while working on a Linux server or even a Mac OS operating system.

As an example of its usage, lets say you are logged into a server via SSH using terminal and need to open another session to begin a long running task.

For this example let us say we need to begin running an rsync command but it will take awhile to complete and we have other tasks to handle while it runs.

With the use of Tmux we could create a new terminal session to begin the rync command inside of and then exit it to revisit later.

While the rsync is running within out Tmux session we can handle other various tasks on the server and re-attach to the session later to check the rsync commands status.

There are many other use cases for Tmux and within this article we will cover the basics you would want to know in order to start using Tmux effectively.

Features of the Tmux utility

  • Tmux allows for the use of multiple sessions which can be detached from and re-attached to. This allows for users to come back to jobs running inside Tmux sessions.
  • Each Tmux session allows for multiple windows and it is quite easy to switch between and keep them organized.
  • Each Tmux session offers multiple panes which then allow for users to split a window into numerous sections where different tasks can be performed side by side ect.
  • You’re able to customize various aspects of Tmux such as the key bindings or status bar.

How to create a Tmux session

It is quite simple to create a new Tmux session and you can do so by entering in the Tmux command without any options.

Running the following command in terminal will create and launcher you into a session:

$ tmux

How to name and open a new Tmux session

When you are working with multiple Tmux sessions it may be helpful to name each based off whichever task is taking place inside of each session.

This overall helps with keeping your work organized and will save time in the long run.

If you’d like to create a new Tmux session and have a name attached to that session you can use the following syntax to do so:

$ tmux new -s session_name

The -s is used to give a name to the session. Substitute session_name for the desired name of your session. The “new” portion of the command specifies it is a new session to be created.

Such as in the above screenshot we are creating a new Tmux session named “test1” which within it we can work on specific tasks and if using multiple windows we can keep track of which is being used for what task if they are named.

How to rename an existing Tmux session

Let’s say we’ve created some Tmux sessions but forgot to name them. This can be frustrating when you’re attempting to re-attach to a specific Tmux session but luckily we’re able to rename pre-existing Tmux sessions to resolve that issue.

1. List all existing Tmux sessions

Before we go ahead and rename a specific Tmux session, let us first list all current sessions so we can rename the desired session to something different.

In order to list all existing sessions we would run the following command in terminal:

$ tmux list-sessions

From the above we can see the session which was opened previously called “test1” and we’ll go ahead and rename it to something different in the next step.

2. Rename the Tmux session

Now that we have a list of existing sessions we will go ahead and rename the session named “test1” to “test-session-1” using the following command:

$ tmux rename-session -t test1 test-session-1

As we can see from the above screenshot we listed all existing Tmux sessions once more and confirmed the name of our session was changed from “test1” to “test-session-1”.

How to attach to an existing Tmux session

Re-attaching to a Tmux session is pretty straight forward. Below we’ll explain how to accomplish this in 2 simple steps.

1. List current sessions of Tmux

First we’ll need to list all current sessions so we know the name of the session we would like to re-attach to.

As we went over previously, we can list all existing sessions with the following command:

$ tmux list-sessions

From the above we see that a session named “test-session-1” exists and we will re-attach to that in step 2.

2. Re-attach to a Tmux session

Now that we know the name of the session we’re going to hop back into, we can use the below command to re-attach to the session named “test-session-1”:

$ tmux attach-session -t test-session-1

How to exit Tmux sessions

Perhaps you have a command running within an attached Tmux session and it will take quite awhile to complete but there are other tasks to get started on.

In this case we would need to detach from this current session in order to begin working on another project.

In order to detach and exit a session which you are currently attached to you would use the following key combination to exit the current attached Tmux session:

Ctrl + b then hit d

How to kill sessions of Tmux

Have you completed a task inside of an active Tmux session and now that is has finished you’d like to terminate that session?

The following command can be executed in order to terminate our example Tmux session named “test-session-1”:

$ tmux kill-session -t test-session-1

Shown above we listed our sessions and it showed “test-session-1” to still be open so we then terminated the session.

After terminating the session we used “list-sessions” once more to confirm it has been deleted.

How to install Tmux on different operating systems

Many newer distributions of Linux include Tmux by default. However if by chance you do not have the Tmux command line utility installed it can be done using the following per each operating system type.

Mac OS Tmux install (using homebrew)

$ brew install tmux

RHEL or Rocky Linux Tmux install

The following would be used if you also need the epel repository added:

$ yum install epel-release -y $$ yum install tmux

If the epel repository is already installed you can just use the standard ‘yum install’ such as in the following:

$ yum install tmux

Fedora Tmux install

For Fedora distributions you can utilize ‘dnf install’:

$ dnf install tmux

Ubuntu Tmux install

On Ubuntu you can install Tmux with the following:

$ apt install tmux

Conclusion

Tmux is an extremely useful terminal-multiplexer utility for Linux Administrators across various distributions.

Whether you need to begin a long running command in a separate session or jump between various tasks all separated in different sessions, Tmux allows for enhanced productivity through multi-tasking.

Related Posts

Using Bash Job Controls to Manage Multiple Processes

Bash job controls are used to send long running tasks into the background, and bring them forward when necessary.

Resolving the “Fatal: Refusing to Merge Unrelated Histories” Error

The "fatal: refusing to merge unrelated histories" occurs when you try and merge an unrelated repo into your own. Here's what it means.

How Curl Follows Redirects on Linux

We use curl regularly to fetch resources from websites. Unfortunately, curl doesn't follow redirects automatically. Here's how to fix that.

Symbolic Links vs Hard Links in Linux

Linux offers various methods for referencing files and directories through other files and directories, without creating copies of the original. If you have color coding enabled in your bash terminal, you might have seen some folders full of files of a different color from regular files. There’s a good chance that these are all symbolic […]

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