I am running Tor as an exit node on Ubuntu. Is it possible to know the number of connections to my exit node at the current time?
Tor has a feature to prevent debuggers like gdb from analyzing tor's memory. This feature inadvertently breaks connection resolvers like the above, so you'll need to add
DisableDebuggerAttachment 0 to your torrc. After that getting the count is easy. In the following case 29124 is my tor pid.
> % netstat -np | grep "29124/tor" | grep ESTABLISHED | wc -l
Be careful about looking at specific connection information. Counts would be fine, but looking at exit destinations would be eavesdropping (... and possibly illegal due to wiretap laws).