Ubuntu 下查看和关闭端口

作者: 云中布衣   分类:  操作系统    热度: (1321℃)   时间: 2016-12-6 19:01   标签: #ubuntu  #web    

这里使用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

wayne@small-T440p: ~-Code-ccsds-webdav_057.png

如果想要关闭可以使用kill

kill -9 pid

这样就Ok了,至于有些进程kill -9 pid 杀不掉的进程就先言尽于此。

(完)

56.8K

发表评论:

© 云中布衣 2015-2022 | Driven by EMLOG  | SiteMap | RunTime: 19.70ms RSS  | TOP

文章数量【319】 评论数量【456】 稳定运行【2871天】

Visitor IP Address【44.200.112.172】

Email:ieeflsyu#outlook.com