I use one daemon per project (so that when I open the client, they don't share buffers). I'd like to get a list of all the daemons that are running.

I tried using lsof -c emacs | grep "TYPE=STREAM" but that doesn't narrow it down sufficiently.

Is there a better way to go about it?

  • 1
    I'm voting to close this question as off-topic because it is not an Emacs question. What's more, it seems OS-specific. – Drew Oct 1 '15 at 1:47
  • 1
    If the only reason you use separate daemons is so that buffers are not shared, you may want to take a look at Perspective. – Scott Weldon Oct 1 '15 at 2:52

By default, on a Unix-like platform, the sockets are located in a directory called /tmp/emacs1234 where /tmp is the value of the environment variable TMPDIR (defaulting to /tmp) and 1234 is your user ID. So to list daemon sockets, assuming you aren't passing any argument to emacsclient other than the daemon name, just list the contents of that directory.

ls "${TMPDIR-/tmp}/emacs$(id -u)"

On many systems you can get away with just

ls /tmp/emacs$UID
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.