标签:linux 端口 进程号
linux 中当我们知道一个服务的名称,需要查看端口,或者知道端口需要查看服务名称时,我们应该怎么做了?
知道服务看端口
[root@nfs ~]# netstat -lntup |grep httpd tcp 0 0 :::80 :::* LISTEN 1695/httpd tcp 0 0 :::443 :::* LISTEN 1695/httpd
2.知道端口看服务名称
[root@nfs ~]# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 1695 root 4u IPv6 20189 0t0 TCP *:http (LISTEN) httpd 1698 apache 4u IPv6 20189 0t0 TCP *:http (LISTEN) httpd 1699 apache 4u IPv6 20189 0t0 TCP *:http (LISTEN) httpd 1700 apache 4u IPv6 20189 0t0 TCP *:http (LISTEN) httpd 1701 apache 4u IPv6 20189 0t0 TCP *:http (LISTEN)
3.知道服务名称查看服务进程
[root@nfs ~]# ps -ef|grep httpd root 1695 1 0 21:01 ? 00:00:00 /usr/sbin/httpd apache 1698 1695 0 21:01 ? 00:00:00 /usr/sbin/httpd apache 1699 1695 0 21:01 ? 00:00:00 /usr/sbin/httpd apache 1705 1695 0 21:01 ? 00:00:00 /usr/sbin/httpd root 3759 1150 0 22:25 pts/0 00:00:00 grep httpd [root@nfs ~]# ps aux |grep httpd root 1695 0.0 0.5 208712 5828 ? Ss 21:01 0:00 /usr/sbin/httpd apache 1698 0.0 0.5 210364 5984 ? S 21:01 0:00 /usr/sbin/httpd apache 1699 0.0 0.5 210364 6000 ? S 21:01 0:00 /usr/sbin/httpd apache 1700 0.0 0.5 210364 5988 ? S 21:01 0:00 /usr/sbin/httpd apache 1701 0.0 0.5 210364 5984 ? S 21:01 0:00 /usr/sbin/httpd
标签:linux 端口 进程号
原文地址:http://ahtornado.blog.51cto.com/4826737/1979111