Linux 命令(218)—— lnstat 命令
2023-02-18 16:33:38 时间
文章目录
1.命令简介
lnstat 显示 Linux 网络统计信息。
lnstat 命令实际上是读取系统“/proc”中目录“/proc/net/stat”下面的文件,来显示当前主机的网络状态的。lnstat 是 rtstat 命令的更新替代命令,功能更完善。
2.命令格式
lnstat [options]
3.选项说明
-c, --count <count>
指定显示网络状态的次数,每隔一定时间显示一次网络状态。
-d, --dump
显示可用的文件或关键字。
-f, --file <file>
要使用的统计文件,可以指定多次。默认情况下扫描 /proc/net/stat 中的所有文件。
-i, --interval <intv>
指定两次显示网络状的间隔秒数。
-j, --json
以 JSON 格式显示结果。
-k, --keys K,K,K,...
只显示给定的关键字
-s, --subject [0-2]
是否显示标题头。0'表示根本没有标题头,'1'只在程序开始时打印标题头,'2'每20行打印一次标题头。
-w, --width N,N,N,...
指定每个字段所占的宽度。
-h, --help
显示帮助信息
-V, --version
显示指令版本信息
4.常用示例
(1)显示网络状态。
lnstat
(2)显示命令支持的统计文件。
lnstat -d
/proc/net/stat/ndisc_cache:
1: entries
2: allocs
3: destroys
4: hash_grows
5: lookups
6: hits
7: res_failed
8: rcv_probes_mcast
9: rcv_probes_ucast
10: periodic_gc_runs
11: forced_gc_runs
12: unresolved_discards
/proc/net/stat/arp_cache:
1: entries
2: allocs
3: destroys
4: hash_grows
5: lookups
6: hits
7: res_failed
8: rcv_probes_mcast
9: rcv_probes_ucast
10: periodic_gc_runs
11: forced_gc_runs
12: unresolved_discards
/proc/net/stat/rt_cache:
1: entries
2: in_hit
3: in_slow_tot
4: in_slow_mc
5: in_no_route
6: in_brd
7: in_martian_dst
8: in_martian_src
9: out_hit
10: out_slow_tot
11: out_slow_mc
12: gc_total
13: gc_ignored
14: gc_goal_miss
15: gc_dst_overflow
16: in_hlist_search
17: out_hlist_search
(3)过滤出只想要查看的关键字段信息。
lnstat -k arp_cache:entries,rt_cache:in_hit,arp_cache:destroys
arp_cach|rt_cache|arp_cach|
entries| in_hit|destroys|
11| 0| 0|
(4)指定两次显示网络状的间隔秒数。
lnstat -i 2
(5)指定显示网络状态的次数。
lnstat -c 2
参考文献
相关文章
- 在linux下搭建NFS服务器实现文件共享
- linux下使用vsftp搭建FTP服务器:匿名登录,账号登录,SSL加密传输
- 在linux下使用Apache搭建文件服务器
- 初阶项目一-集成一套linux系统:红帽系统,LVM分区,Apache服务,MySQL服务,数据定时备份脚本
- linux下为什么每次修改完配置文件之后都需要重新加载配置文件
- linux下/etc/profile /etc/bashrc /root/.bashrc /root/.bash_profile这四个配置文件的加载顺序
- linux下srpm源码包的使用和安装
- linux源码编译安装软件原理
- linux下使用chattr创建一个连root都无法删除的文件
- 解决”将公司Linux服务器上的脚本导出到windows上打开串行的“问题
- 解决“在windows里的记事本里编辑的汉字文本文件,上传到linux服务器上出现乱码“问题
- linux 下对zip,rar,tar,tar.gz,tar.bz2,tar.xz,gzip,bzip2,xz文件的归档,压缩和解压缩
- linux 为普通用户配置sudo权限
- linux 配置本地yum源,配置国内yum源,配置epel源
- linux下YUM工具的使用:yum安装/升级/查看/搜索/卸载软件包
- linux下RPM工具的使用:RPM安装/查询/查看/卸载/升级软件包
- linux 文件扩展权限ACL(访问控制列表)
- linux 文件的特殊权限:suid sgid sticky
- linux文件权限管理:文件权限类型,文件权限影响,设定文件权限,取消文件权限
- 解决linux家目录模板文件被删之后显示不正常的问题