这里使用netstat命令,其功能是
Print network connections, routing tables, interface statistics, masquerade,connections, and multicast memberships
SYNOPSIS
netstat [address_family_options] [--tcp|-t] [--udp|-u] [--raw|-w] [--listening|-l]
[--all|-a] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users]
[--symbolic|-N] [--extend|-e[--extend|-e]] [--timers|-o] [--program|-p] [--verbose|-v]
[--continuous|-c]
具体信息可以查看系统的man函数。
首先查看端口:
netstat -anp
如果直接用这个命令会有一个问题,输出的信息过多,因此可以通过grep函数去筛选你想要查看的端口。
例如我想查看https服务端口443,那么我可以用下面命令:
netstat -anp | grep 443
如果想要关闭可以使用kill
kill -9 pid
这样就Ok了,至于有些进程kill -9 pid 杀不掉的进程就先言尽于此。
(完)
发表评论: