How to List Tmux Sessions [3 Effective Ways]

Written by

Reviewed by

Last updated: July 10, 2024

Expert verified

SVG Image


To list Tmux sessions, you can try these three methods:

  1. Use the command tmux list-sessions in the Terminal to quickly list active Tmux sessions.
  2. Press Ctrl-b followed by s within a Tmux session to access a session selection menu and switch between sessions.
  3. Press Ctrl-b followed by : to enter the Tmux command prompt, then enter the command list-sessions to view active sessions.

Continue reading the article below to discover three methods to list Tmux sessions and common errors that can occur when listing sessions.

Managing multiple terminal sessions can be overwhelming, but Tmux makes it easier. If you’ve struggled to keep track of different tasks in your terminal, this post is for you. I’ll show you how to list Tmux sessions and fix common errors, so you can manage your sessions better and keep your workflow smooth. Let’s explore and make your terminal experience more manageable and efficient.

What is Tmux?

Tmux is a terminal multiplexer. It lets you run multiple terminal sessions within a single window. You can switch between these sessions easily, split your window into panes, and even detach from a session, leaving it running in the background. Tmux helps you manage various tasks in one terminal window, making your workflow more efficient.

Using Tmux offers several advantages:

  • Session Management: Keep multiple terminal sessions open and switch between them without losing your work.
  • Increased Productivity: Split your window into multiple panes, allowing you to monitor different tasks simultaneously.
  • Persistence: Detach from a session and leave it running. You can reattach later, picking up exactly where you left off.
  • Remote Work: Tmux sessions continue to run even if your connection drops, making it ideal for remote work.

How to List Tmux Sessions?

To list tmux sessions, simply open your terminal and enter the command tmux list-sessions. This will display all active tmux sessions, showing their names, window counts, and statuses. It’s an effective way to quickly see all the tmux environments you have running and choose which one to access or manage.

That was the quick answer. Here is the detailed step-by-step guide of three different methods to Tmux list all sessions.

1. Command Line

Using the command line to show Tmux sessions is quick and straightforward. This method is ideal for users who prefer a command-driven approach or need to incorporate session listing into scripts or automation workflows. Follow these steps to list Tmux sessions:

  1. Open your Terminal by pressing Ctrl+Alt+T.
opening terminal
  1. Enter the following command:
tmux list-sessions

The Terminal will list all active Tmux sessions, including their session IDs and attached clients.

    listing all active tmux sessions 1

    2. Tmux Shortcut

    The Tmux shortcut provides a convenient way to check Tmux sessions while working within a Tmux session. This method is useful when you are already inside a Tmux session and want to quickly switch to a different session without leaving your current Terminal environment. Here are the steps to do it:

    1. Start or attach to a Tmux session. While inside the Tmux session, press Ctrl-b. This will activate the Tmux command prompt.
    2. Release Ctrl-b and then press s.
    pressing keys to open session selection menu
    1. A session selection menu will appear, showing all available Tmux sessions. Use the arrow keys to navigate through the list of sessions. Once you have highlighted the desired session, press Enter to select it.
    opening session selection menu to choose session

    3. Tmux Command Prompt

    Accessing the Tmux command prompt allows you to execute Tmux commands directly and efficiently. This method is beneficial when you want to interact with Tmux through a dedicated prompt, enabling you to see Tmux sessions and perform other Tmux operations seamlessly. Follow these steps:

    1. Attach to a Tmux session and press Ctrl-b to activate the Tmux command prompt.
    2. Release Ctrl-b and then type :. The command prompt will now be ready to accept Tmux commands.
    3. Enter the following command to list sessions:
    opening sessions list using tmux command prompt
    1. Tmux will list all active sessions, including their session IDs and attached clients.
    displaying list of active sessions

    How to Attach a Tmux Session?

    Attaching to a tmux session allows you to reconnect to an existing session that may have been detached or left running in the background. This feature is particularly useful for returning to your work environment exactly as you left it, whether it was on purpose or because of a disconnected remote session. Here’s how to attach to an existing tmux session:

    1. Start by opening a Terminal window.
    2. Before you can attach to a session, you need to know what sessions are available. Type the following command:
    tmux list-sessions

    This command will display all existing sessions, showing their names and some additional details. 

    listing all tmux sessions

    If you have multiple sessions, identify the one you want to attach to from the list. Each session will typically be identified by a name or number.

    1. If no sessions exist, it will return nothing, and you’ll need to start a new session by simply typing:
    create a new tmux session
    1. To attach to a session, use the attach-session command followed by the -t option, which stands for target:
    tmux attach-session -t session-name

    Replace session-name with the name or number of the session you want to attach to. 

    reattaching to a specific tmux session
    1. If the session name is a number, you can simplify the command to:
    tmux a -t 0
    attaching to a session whose name is number

    To learn how to detach a Tmux session, read this detailed guide on how to detach a Tmux session.

    4 Common Errors When Listing Sessions in Tmux

    When listing Tmux sessions, it’s possible to encounter a few common errors. By being aware of these common errors and their solutions, you can troubleshoot and overcome any issues you may encounter while attempting to list Tmux sessions effectively. Here are four errors you may come across and their possible solutions:

    1. 💡“No sessions found” Error

    This error occurs when listing Tmux sessions, but no active sessions are available. It typically happens when Tmux has not started or all existing sessions have been terminated.

    • To resolve this error, you can start a new Tmux session using the tmux new-session command or check for existing sessions using commands like tmux list-sessions or tmux ls to ensure that there are active sessions before attempting to list them.

    2. ❓ “Unknown command list-sessions” Error

    If you encounter the error message “Unknown command ‘list-sessions'”, it suggests that Tmux does not recognize the command you used to list sessions. This issue can occur due to a typo in the command or if you are using an outdated version of Tmux that does not support the specific command.

    • Double-check the command syntax, ensuring proper capitalization and spacing. Additionally, consult the Tmux documentation or use alternative commands such as ls or list-s that may be compatible with your Tmux version.

    3. ⚠️ Tmux not installed or not in PATH Error

    This error occurs when Tmux is not installed on your system, or the Tmux executable is not in the system’s PATH variable. Ensure that Tmux is installed using the appropriate package manager for your operating system.

    • If Tmux is already installed, verify that the Tmux executable is added to the system’s PATH variable, which allows the system to locate and execute the Tmux command. If necessary, modify your PATH variable or consult the documentation for your operating system on how to set the PATH correctly.

    4. 🔒 Insufficient permissions

    When encountering an “insufficient permissions” error, it indicates that the user running the command does not have the necessary permissions to access or interact with Tmux sessions. This error can arise if the user does not have the appropriate rights to execute Tmux commands or access the Tmux socket files.

    • To resolve this issue, ensure that the user has the required permissions. If available, you can try running the Tmux commands with elevated privileges using sudo or other administrative tools. If you’re working in a shared environment or on a managed system, contact the system administrator for assistance in obtaining the necessary permissions.

      Tmux List Sessions: Summing Up

      In this article, I’ve shown you various methods to list Tmux sessions and troubleshoot common errors. Whether you prefer using the command line, shortcuts, or the Tmux command prompt, you now have the tools to manage your Tmux sessions effectively.

      If you want to further enhance your Tmux skills, you might be interested in these topics:

      Frequently Asked Questions

      How can I rename a Tmux session?

      To rename a Tmux session, switch to the desired session and use the command tmux rename-session new_name. This allows you to give your session a more descriptive or meaningful name. Renaming sessions can be helpful when you want to identify and manage your sessions easily. Remember to list the sessions using tmux list-sessions or tmux ls to verify the updated name.

      Is it possible to share a Tmux session with other users?

      Yes, you can share a Tmux session with other users. Using the session attaching feature, multiple users can connect to the same session simultaneously. To share a Tmux session, start with tmux new-session -s session_name or attach to an existing session with tmux attach-session -t session_name. Share the session name with others who want to join, and they can attach to the session using tmux attach-session -t session_name in their own Terminals.

      Can I customize the appearance of Tmux session status bars?

      Absolutely! Tmux allows you to customize the appearance of session status bars. You can modify the status bar colors, display additional information, or create custom themes. To customize the status bars, edit the Tmux configuration file (~/.tmux.conf) and add directives for colors, information display, or theme customization. With these customization options, you can create a personalized and visually appealing status bar that suits your preferences and enhances your Tmux experience.



      Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.



      Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

      Share this article
      Shareable URL
      Prev Post

      How to Kill Tmux Session [4 Best Methods]

      Next Post

      How to Check CPU Frequency Linux? [8 Easy Ways]

      Leave a Reply

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

      Read next