24

I am trying to get a list of tmux sockets that are currently being used but the best solution I've come up with so far is to check in /tmp/tmux* or TMPDIR.

As far as I can tell tmux keeps these sockets around for some amount of time even if no current tmux session is using them.

As such I was hoping there was something similar to tmux list-sessions, but for sockets, that would give me all the sockets that are currently being used. I couldn't seem to find one in the man page and if there was one I didn't properly understand that listing sockets was its purpose.

Thanks!

Billy Monk
  • 543
  • 5
  • 9

2 Answers2

31

To list all sockets used by tmux you can use lsof:

lsof -U | grep '^tmux'

Use sudo if the inquirer doesn't own the process.

Thor
  • 45,082
  • 11
  • 119
  • 130
0

Assuming that the tmux sockets are located at /tmp, which is where they wil be by default, To list all the sockets,

lsof | grep tmp/tmux

Paul
  • 303
  • 1
  • 7