(1)
lsof -i :80 查看80端口被什么程序占用
netstat -an | grep :80 查看80端口的是否已在使用中,可验证使用该端口的服务是否已正常运行
netstat -tunlp | grep :80 查看80端口是被哪个服务使用着
[root@www.linuxidc.com log]# netstat -tunlp | grep 80
tcp 0 0 :::80 :::* LISTEN 1013/httpd
ps aux | grep httpd 查看httpd服务是否已启动
(2)
#netstat -antp | grep 服务名或端口号 如: #netstat -antp | grep httpd #netstat -antp | grep :80 |
这个是最常用的组合:
-a all,所有被监听的连接
-n number,把能以数字表示的用数字表示
-t tcp,tcp协议的
-p programs,输出进程名