리눅스 포트 사용중인 프로세스 확인 방법
리눅스(Ubuntu)에서 포트 사용중인 프로세스 확인 방법
# netstat -tulpn
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:45650 0.0.0.0:* LISTEN 24336/python3
tcp 0 0 127.0.0.1:45490 0.0.0.0:* LISTEN 8301/python3
tcp 0 0 127.0.0.1:46483 0.0.0.0:* LISTEN 12022/python3
tcp 0 0 127.0.0.1:41939 0.0.0.0:* LISTEN 8154/python3
tcp 0 0 127.0.0.1:37395 0.0.0.0:* LISTEN 1075/python3
tcp 0 0 127.0.0.1:41395 0.0.0.0:* LISTEN 4683/python2
프로세스 id를 확인하면 아래와 같이 ld -l /proc/프로세스id/exe 명령어를 사용하여
포트와 연동된 프로그램 이름과 경로도 확인할 수 있다.
# ls -l /proc/5313/exe
l**x 1 user user 0 11월 26 03:39 /proc/5313/exe -> /kibana/node/bin/node
참고: https://www.cyberciti.biz/faq/what-process-has-open-linux-port/