例如要关闭22号端口:
$ netstat -anp | grep :22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 988/sshd
如此,知道了22号端口对应的进程ID 988,只要kill掉该进程即可关闭该端口:
$ kill 988