netstat的1基本用法有哪些
发表于:2025-02-06 作者:千家信息网编辑
千家信息网最后更新 2025年02月06日,这篇文章将为大家详细讲解有关netstat的1基本用法有哪些,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。显示当前所有的链接root@ts:~# netstat -
千家信息网最后更新 2025年02月06日netstat的1基本用法有哪些
这篇文章将为大家详细讲解有关netstat的1基本用法有哪些,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
显示当前所有的链接
root@ts:~# netstat -aActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:domain *:* LISTEN tcp 0 0 testforpaas.21vi:domain *:* LISTEN tcp 0 0 localhost:5433 *:* LISTEN tcp 0 0 localhost:smtp *:* LISTEN tcp 0 0 localhost:6010 *:* LISTEN
只显示tcp和dup
root@ts:~# netstat -tau
禁用反向域名解析,加快查询速度
默认情况下 netstat 会通过反向域名解析技术查找每个 IP 地址对应的主机名。这会降低查找速度。如果你觉得 IP 地址已经足够,而没有必要知道主机名,就使用 -n 选项禁用域名解析功能
root@ts:~# netstat -antActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 172.16.16.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:8123 0.0.0.0:* LISTEN
只列出监听中的连接
任何网络服务的后台进程都会打开一个端口,用于监听接入的请求。这些正在监听的套接字也和连接的套接字一样,也能被 netstat 列出来。使用 -l 选项列出正在监听的套接字
root@ts:~# netstat -tnlActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 172.16.16.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:8123 0.0.0.0:* LISTEN
获取进程名、进程号以及用户 ID
root@ts:~# netstat -tlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 localhost:domain *:* LISTEN 1080/dnsmasq tcp 0 0 testforpaas.21vi:domain *:* LISTEN 1080/dnsmasq tcp 0 0 localhost:5433 *:* LISTEN 11237/postgres tcp 0 0 localhost:smtp *:* LISTEN 1371/sendmail: MTA:tcp 0 0 localhost:6010 *:* LISTEN 9389/6
获取进程名和用户名
root@ts:~# netstat -tlpeActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program nametcp 0 0 localhost:domain *:* LISTEN root 15870 1080/dnsmasq tcp 0 0 testforpaas.21vi:domain *:* LISTEN root 15868 1080/dnsmasq tcp 0 0 localhost:5433 *:* LISTEN postgres 130080 11237/postgres tcp 0 0 localhost:smtp *:* LISTEN root 17826 1371/sendmail: MTA
显示进程名和用户ID
root@ts:~# netstat -tlpenActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program nametcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 0 15870 1080/dnsmasq tcp 0 0 172.16.16.1:53 0.0.0.0:* LISTEN 0 15868 1080/dnsmasq tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN 116 130080 11237/postgres tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 17826 1371/sendmail: MTA
打印统计数据
netstat 可以打印出网络统计数据,包括某个协议下的收发包数量
root@ts:~# netstat -tnsIcmpMsg: InType0: 93 InType3: 14674 InType11: 27391 OutType3: 18230 OutType8: 38060Tcp: 23583 active connections openings 139747 passive connection openings 21350 failed connection attempts 1512 connection resets received 4 connections established 4263613 segments received 4716472 segments send out 171992 segments retransmited 55 bad segments received. 151266 resets sent
显示内核路由信息
root@ts:~# netstat -rnKernel IP routing tableDestination Gateway Genmask Flags MSS Window irtt Iface0.0.0.0 172.16.16.62 0.0.0.0 UG 0 0 0 ens16010.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br-9547a5f0faec10.20.0.0 10.20.101.9 255.255.0.0 UG 0 0 0 ppp0
打印网络接口
netstat 也能打印网络接口信息,-i 选项就是为这个功能而生
root@ts:~# netstat -iKernel Interface tableIface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flgbr-9547a5f0faec 1500 0 55883292 0 0 0 89519216 0 0 0 BMRUdocker0 1500 0 49 0 0 0 16 0 0 0 BMUens160 1500 0 152552760 0 611 0 60254997 0 0 0 BMRUlo 65536 0 583345 0 0 0 583345 0 0 0 LRUppp0 1354 0 2157 0 0 0 1679 0 0 0 MOPRUveth6dd978f 1500 0 12751092 0 0 0 18590019 0 0 0 BMRU
输出友好信息
root@ts:~# netstat -eiKernel Interface tablebr-9547a5f0faec Link encap:Ethernet HWaddr 02:42:ee:4b:21:05 inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::42:eeff:fe4b:2105/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:55883460 errors:0 dropped:0 overruns:0 frame:0 TX packets:89519456 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:7839329499 (7.8 GB) TX bytes:199950345292 (199.9 GB)docker0 Link encap:Ethernet HWaddr 02:42:8f:b2:de:7a inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0 inet6 addr: fe80::42:8fff:feb2:de7a/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:49 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1372 (1.3 KB) TX bytes:1368 (1.3 KB)
netstat 持续输出
root@ts:~# netstat -cuActive Internet connections (w/o servers)Proto Recv-Q Send-Q Local Address Foreign Address State udp6 0 0 localhost:37429 localhost:37429 ESTABLISHED
打印 active 状态的连接
netstat -atnp | grep ESTA
监视active状态连接
watch -d -n0 "netstat -atnp | grep ESTA"
关于"netstat的1基本用法有哪些"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
进程
网络
监听
信息
域名
套接字
用户
篇文章
主机
功能
地址
接口
数据
更多
正在
状态
统计数据
速度
统计
输出
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
怎么通过服务器访问谷歌
医院网络安全员岗位职责
武汉斑马网络技术待遇
密室杀手在我的世界哪个服务器中
无锡电商软件开发问答知识
要建立统一高效网络安全什么机制
浙江大学软件开发出来工资
通信技术是网络技术吗
怎样用服务器制作下载链接
网络安全意识校园
数据库基本语句及应用
json 获取数据库数据
觅糖互联网科技有限公司
my sql数据库实训总结
网络安全2017年
wdcp数据库目录
网络安全等保3.0测评
c 泛型的数据库实体插入
如何复制命令行窗口数据库
中兴高级软件开发工程师
奈飞 服务器连接不上
网络技术学习软件自律
网络安全监测系统和装置
数据库开发说什么语言
bim数据库管理公司
数据库怎么修改字段大小
奥特曼游戏服务器
武义软件开发有限公司
百度网络安全员培训班
2020年全球网络安全指数