How to list tmux sessions?

Quick Answer

To list all tmux sessions, use the command tmux list-sessions or its shorthand tmux ls.

$ tmux ls

Detailed Explanation

Listing tmux sessions allows you to see all active sessions, their names, and status information. This is particularly useful when you have multiple detached sessions and need to identify which one to attach to.

Ways to list tmux sessions:

  • tmux list-sessions - Full command
  • tmux ls - Shortened version of the command
  • Within tmux: Ctrl+b s - Shows interactive session list

Understanding the output:

0: 1 windows (created Fri May 31 12:34:56 2025) [80x24]
1: 3 windows (created Fri May 31 13:45:12 2025) [80x24] (attached)
dev: 2 windows (created Fri May 31 14:10:34 2025) [80x24]

The output shows:

  • Session name/number: Numbered sessions (0, 1) or named sessions (dev)
  • Window count: Number of windows in each session
  • Creation time: When the session was created
  • Size: Terminal dimensions in columns x rows
  • Status: (attached) indicates you're currently connected to that session

Attaching to a listed session:

  • tmux attach -t 0 - Attach to session number 0
  • tmux attach -t dev - Attach to session named "dev"

Pro Tip

To create a named session, use tmux new -s session-name. Named sessions are easier to identify than numbered ones.

Interactive Session List

When inside tmux, press Ctrl+b s to show an interactive list of sessions. Use arrow keys to select a session, then press Enter to switch to it.