[1] show services using lsOF
"lsOF" stands for List of Open Files.
$ sudo lsof -iTCP -sTCP:LISTEN | grep mongo mongod 7654 mongodb 5u IPv4 120738 0t0 TCP *:27017 (LISTEN) mongod 7654 mongodb 6u IPv4 121673 0t0 TCP *:28017 (LISTEN)
or
[2] ls all Open Files(of) by processes
$ sudo lsof lsof | wc -l # number of fs opened by processes on my mac 7997
[3]
$ netstat -ap tcp | grep -i "listen" tcp46 0 0 *.XmlIpcRegSvc *.* LISTEN tcp46 0 0 *.52372 *.* LISTEN tcp46 0 0 *.eforward *.* LISTEN tcp46 0 0 *.52371 *.* LISTEN tcp4 0 0 localhost.tick-port *.* LISTEN tcp4 0 0 localhost.8005 *.* LISTEN tcp46 0 0 *.8009 *.* LISTEN tcp46 0 0 *.sunwebadmins *.* LISTEN tcp46 0 0 *.61977 *.* LISTEN tcp46 0 0 *.57305 *.* LISTEN tcp4 0 0 *.65473 *.* LISTEN tcp4 0 0 localhost.50756 *.* LISTEN tcp4 0 0 localhost.63342 *.* LISTEN tcp4 0 0 localhost.6942 *.* LISTEN tcp46 0 0 *.18170 *.* LISTEN tcp4 0 0 localhost.4380 *.* LISTEN tcp4 0 0 localhost.4370 *.* LISTEN tcp46 0 0 *.49166 *.* LISTEN tcp6 0 0 localhost.commplex *.* LISTEN tcp4 0 0 localhost.commplex-lin *.* LISTEN tcp4 0 0 localhost.fmpro-intern *.* LISTEN tcp46 0 0 *.http-alt *.* LISTEN tcp46 0 0 *.8188 *.* LISTEN tcp4 0 0 localhost.29754 *.* LISTEN tcp4 0 0 localhost.1023 *.* LISTEN tcp4 0 0 *.kerberos *.* LISTEN tcp6 0 0 *.kerberos *.* LISTEN tcp4 0 0 *.ssh *.* LISTEN tcp6 0 0 *.ssh *.* LISTEN tcp4 0 0 *.rfb *.* LISTEN tcp6 0 0 *.rfb *.* LISTEN
If you want to search by port,
$ lsof -n -i4TCP:9090
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 16887 a1353612 50u IPv6 0xfd8e7d8cb6c2ffcd 0t0 TCP *:websm (LISTEN)
References
prayag@Prayag:~/workspace_grails/eccount$ man lsof lsof - list open files -i [i] This option selects the listing of files any of whose Internet address matches the address specified in i. If no address is specified, this option selects the listing of all Internet and x.25 (HP-UX) network files.
No comments:
Post a Comment