问题
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!
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/11333291/is-it-possible-to-find-tmux-sockets-currently-in-use