Netstatでポートの使用状況の確認を行いたかった
調べたら色々便利だった
$ netstat -tlnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2590/sendmail tcp 0 0 0.0.0.0:22555 0.0.0.0:* LISTEN 10352/sshd tcp 0 0 0.0.0.0:41510 0.0.0.0:* LISTEN 2333/rpc.statd tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2312/rpcbind tcp 0 0 :::22555 :::* LISTEN 10352/sshd tcp 0 0 :::34535 :::* LISTEN 2333/rpc.statd tcp 0 0 :::111 :::* LISTEN 2312/rpcbind
$ lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 7840 apps 6u IPv4 8239961 0t0 TCP *:http (LISTEN) nginx 7841 apps 6u IPv4 8239961 0t0 TCP *:http (LISTEN) nginx 7842 apps 6u IPv4 8239961 0t0 TCP *:http (LISTEN) nginx 7843 apps 6u IPv4 8239961 0t0 TCP *:http (LISTEN)
両コマンドともsudoで行ったほうが良さげ