A tmux server can hold several named sessions, including sessions with no terminal currently attached. Listing tmux sessions shows which workspaces exist before you choose one to attach to, rename, or remove.
The list-sessions command asks the running tmux server for every session it manages and prints one line per session. The default output starts with the session name, then the window count and creation timestamp; tmux ls is the short alias for the same command.
Sessions belong to one server and are normally private to the user who started it. A list covers only the selected server, so an unreachable default socket does not rule out sessions on another socket, under another account, or on another host.
Steps to list tmux sessions:
- List all sessions managed by the selected tmux server.
$ tmux list-sessions build: 1 windows (created Thu Nov 5 07:33:55 2026) ops: 2 windows (created Thu Nov 5 07:33:55 2026)
Outside tmux, this normally uses your account's default server socket. Inside tmux, the TMUX environment variable selects the current server instead. The list includes attached and detached sessions on that server; it does not search other users or server sockets. An explicit tmux -L default list-sessions selects your default socket even from inside another server.
The text before the colon is the session name, which is the target used by commands such as attach-session -t, rename-session -t, and kill-session -t.
- Add a custom format when you want the list to emphasize the window count or attached state instead of the default creation timestamp.
$ tmux list-sessions -F '#{session_name}: #{session_windows} windows (#{?session_attached,attached,detached})' build: 1 windows (detached) ops: 2 windows (detached)-F expands tmux format strings, so you can swap in fields such as #{session_created} or #{session_attached} when a script or status check needs different details. Detached means no client is currently attached to that session.
- Filter the list when the server has many sessions and only one target name matters.
$ tmux list-sessions -f '#{==:#{session_name},ops}' ops: 2 windows (created Thu Nov 5 07:33:55 2026)-f keeps the normal output format but only prints sessions whose format expression evaluates true. Exact-name filters are useful before a targeted attach, rename, or kill command when similar session names exist.
- Check the socket path in the error if the list cannot reach a server.
$ tmux list-sessions error connecting to /tmp/tmux-1000/default (No such file or directory)
A missing socket can produce this error; an existing socket without a listening server can produce no server running on /tmp/tmux-1000/default. Both mean the client could not reach a server at that path, not that no sessions exist elsewhere. The numeric directory varies by user ID, and TMUX_TMPDIR can change its parent directory. If the intended server has no sessions yet, creating a session starts it.
- List sessions on an already-known named socket when your sessions use a separate server.
$ tmux -L work list-sessions monitoring: 1 windows (created Thu Nov 5 07:33:55 2026)
Here, work is the socket name used when starting the server, not a session name. It must match the intended server's socket name under the same account and socket directory. The -L option goes before list-sessions and also works with the formatting and filtering options above. If you know the full socket path instead, tmux -S /tmp/tmux-1000/work list-sessions selects that path directly; 1000 is the user ID in that socket directory.