I have been using tmux for maybe 4-5 months and recently started noticing some weird stuff.

  1. tmux ls does not show the full list of active "sessions"
  2. I still can connect to a session even if it does not show up on tmux ls
  3. Some of my sessions started getting indexes in their names.. like name_of_session_3

I use tmux on a remote machine that ssh into. I usually have multiple terminals open in separate tabs on my local machine, but I would not expect any of this to affect the way tmux behave.

What am I doing wrong?

Here is the out put of tmux ls

➜ ~ tmux ls bad*******-1: 1 windows (created Mon Mar 12 15:27:29 2018) [273x129] (group badges_hist) bad*******_fix-9: 1 windows (created Thu Mar 22 11:42:28 2018) [208x54] (group bad*******) (attached) no*******-7: 1 windows (created Wed Mar 21 15:17:33 2018) [273x129] (group *******) not*******s-8: 1 windows (created Wed Mar 21 15:47:01 2018) [208x54] (group noti*******) (attached) pre*******-2: 1 windows (created Tue Mar 13 14:24:33 2018) [273x129] (group pre*******)

I would expect to see another 3-4 sessions on that list.

  • In the text, you use the words "terminal" and "session". Can you clarify what you mean by "terminal"? Do you use the word as equivalent to "session"? Could you show an example of the output of tmux ls and how it is different from what you would expect?
    – Kusalananda
    Apr 5, 2018 at 21:41
  • went through tmux manual. I should have used "session" in tmux context. provided example tmux ls output as well.
    – Rotkiv
    Apr 5, 2018 at 21:47

2 Answers 2


tmux list-sessions (or tmux ls) won't list sessions that are started under another socket.

$ tmux
# ... same as
# tmux -L default

$ tmux -L lofa
$ tmux -L lofa new

# (Detaching from each session after creation
#  via "<prefix> d" or "CTRl-b d")

$ tmux ls
# ... same as
# tmux -L default list-sessions
0: 1 windows (created Tue Apr 25 15:12:07 2023)

$ tmux -L lofa new
0: 1 windows (created Tue Apr 25 15:17:00 2023)
1: 1 windows (created Tue Apr 25 15:21:59 2023)

From the tmux man page:

 -L socket-name
               tmux stores the server socket in a directory under
               TMUX_TMPDIR or /tmp if it is unset.  The default
               socket is named default.  This option allows a
               different socket name to be specified, allowing
               several independent tmux servers to be run.  Unlike
               -S a full path is not necessary: the sockets are all
               created in a directory tmux-UID under the directory
               given by TMUX_TMPDIR or in /tmp.  The tmux-UID
               directory is created by tmux and must not be world
               readable, writable or executable.

So looks like ssh forwarding is the issue?

Tmux captures the environment at initiation. If you are on your desktop with SSH_AUTH_SOCK pointing to A, then you disconnect (C-a,d). Now you SSH to your desktop, the SSH_AUTH_SOCK in this environment will be some value B, you reattach, and you have SSH_AUTH_SOCK still pointing to A.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .