Skip to content

Instantly share code, notes, and snippets.

@firefirer1983
Created July 29, 2020 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save firefirer1983/84d34df9f3581cc7e5e45bebe637d14f to your computer and use it in GitHub Desktop.
Save firefirer1983/84d34df9f3581cc7e5e45bebe637d14f to your computer and use it in GitHub Desktop.
查看进程占用端口
# sudo lsof -i:8000
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
nodejs  26993 root   10u  IPv4 37999514      0t0  TCP *:8000 (LISTEN)


netstat -tunlp | grep 8000

- -t(tcp) 仅显示tcp相关
- -u(udp) 仅显示udp相关
- -n(不显示别名)
- -l 仅列出在Listen(监听)的服务状态
- -p 显示建立相关链接的程序名
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment