[root@localhost ~]# w 21:57:05 up 5 min, 2 users, load average: 0.02, 0.11, 0.07 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 21:51 5:37 0.03s 0.03s -bash root pts/0 192.168.5.1 21:51 1.00s 0.04s 0.03s w
[root@localhost ~]# uptime 22:00:06 up 9 min, 2 users, load average: 0.00, 0.06, 0.05
[root@localhost ~]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 60 model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz stepping : 3 microcode : 0x1e cpu MHz : 2500.943 cache size : 6144 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt arat bogomips : 5002.00 clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management:
查看包括 cpu, 内存,虚拟磁盘,交换分区,磁盘,系统进程等等。python
[root@localhost ~]# vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 0 1570240 2076 172496 0 0 69 5 72 96 0 1 99 1 0
[root@localhost ~]# vmstat 1 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 0 1570256 2076 172528 0 0 67 5 71 94 0 0 99 1 0 0 0 0 1570240 2076 172528 0 0 0 0 58 56 1 1 98 0 0 0 0 0 1570240 2076 172528 0 0 0 0 52 48 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 47 39 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 42 36 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 44 38 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 47 43 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 41 37 0 0 100 0 0 1 0 0 1570240 2076 172528 0 0 0 0 45 38 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 43 38 0 1 99 0 0
[root@localhost ~]# vmstat 1 5 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 0 1570256 2076 172528 0 0 64 5 70 92 0 0 99 1 0 0 0 0 1570240 2076 172528 0 0 0 0 47 44 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 45 39 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 52 42 0 0 100 0 0 0 0 0 1570240 2076 172528 0 0 0 0 54 52 0 1 99 0 0
- r,run表示有多少进程运行
- b, block进程被cpu之外的资源阻断,处于等待状态。
- swpd,数字在不断变化,表示磁盘和交换分区在交换数据,须要增长内存。
- si,有多少个kb的数据进入swpd,若是swpd有变化,这si,so两列的数字也会有变化。
- so,有多少个kb的数据输出swpd。
- bi,跟磁盘有关系。数据从磁盘里面出来进入到内存里面去。从磁盘里面的读。
- bo,从内存里面出来,进入到磁盘里面去。从磁盘里面写入。
- us,表示用户级别的资源占用cpu的百分比。
- sy.表示系统的资源占用cpu的百分比。
- wa,等待cpu的百分比。
查看进程使用资源状况linux
选项:ios
top命令中的交互命令web
top - 22:50:17 up 59 min, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 89 total, 1 running, 88 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867024 total, 1569680 free, 122440 used, 174904 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1561460 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 128164 6816 4056 S 0.0 0.4 0:01.70 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:00.49 rcu_sched
名称 | 说明 |
---|---|
22:50:17 | 系统当前时间 |
up 59 min | 系统运行时间,本机已经运行59min |
2 users | 当前登陆了两个用户 |
load average: 0.00, 0.01, 0.05 | 系统在以前1分钟,5分钟,15分钟的平均负载。通常认为小于1时,负载较小。若是大于1,系统就已经超出负荷。 |
Tasks: 89 total, 1 running, 88 sleeping, 0 stopped, 0 zombieapi
名称 | 说明 |
---|---|
89 total | 显示有多少个进程 |
1 running | 正在运行的任务数量 |
88 sleeping | 休眠状态的任务数量 |
0 stopped | 中止任务的数量 |
0 zombie | 僵尸进程(主进程已经中止,剩下子进程不容许) |
名称 | 说明 |
---|---|
%Cpu(s): 0.0 us | 用户模式占用CPU的百分比 |
0.0 sy | 系统模式占用的百分比 |
0.0 ni | 改变过优先级的用户进程占用的CPU百分比 |
100.0 id | 空闲CPU的CPU百分比 |
0.0 wa | 等待输入/输出的进程的占用CPU百分比 |
0.0 hi | 硬中断请求服务占用的CPU百分比 |
0.0 si | 软中断请求服务占用的CPU百分比 |
0.0 st | st(steal time)虚拟时间百分比。就是当有虚拟机时,虚拟CPU等待实际CPU的时间百分比。 |
KiB Mem : 1867024 total, 1569680 free, 122440 used, 174904 buff/cache······物理内存使用状况缓存
KiB Swap: 2097148 total, 2097148 free, 0 used. 1561460 avail Mem ······ 交换分区使用状况bash
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ······ 默认是按照cpu占用百分比排序,使用较多的排在最前面。网络
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 574 root 20 0 334236 28988 6896 S 0.0 1.6 0:01.42 firewalld 884 root 20 0 562392 16608 5916 S 0.0 0.9 0:01.04 tuned 535 polkitd 20 0 534896 12828 4848 S 0.0 0.7 0:00.35 polkitd 580 root 20 0 482408 9204 6904 S 0.0 0.5 0:00.29 NetworkManager 1 root 20 0 128164 6816 4056 S 0.0 0.4 0:01.71 systemd 537 root 20 0 305296 6308 4928 S 0.0 0.3 0:05.64 vmtoolsd 375 root 20 0 48092 6192 2816 S 0.0 0.3 0:00.47 systemd-udevd 525 root 20 0 99608 6096 4492 S 0.0 0.3 0:00.27 VGAuthService
top - 23:15:01 up 1:23, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 89 total, 1 running, 88 sleeping, 0 stopped, 0 zombie %Cpu0 : 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867024 total, 1568972 free, 123056 used, 174996 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1560780 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 537 root 20 0 305296 6308 4928 S 0.3 0.3 0:05.77 vmtoolsd 539 root 20 0 24308 1716 1396 S 0.3 0.1 0:00.09 systemd-logind 1 root 20 0 128164 6816 4056 S 0.0 0.4 0:01.72 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.11 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:00.52 rcu_sched
top - 23:16:46 up 1:25, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 89 total, 1 running, 88 sleeping, 0 stopped, 0 zombie %Cpu0 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867024 total, 1568972 free, 123056 used, 174996 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1560780 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 251 root 20 0 0 0 0 S 0.3 0.0 0:00.29 kworker/u256:2 1 root 20 0 128164 6816 4056 S 0.0 0.4 0:01.72 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.12 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:00.52 rcu_sched
top - 23:18:35 up 1:27, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 89 total, 1 running, 88 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867024 total, 1569468 free, 122560 used, 174996 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1561276 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 40 root 20 0 0 0 0 S 0.3 0.0 0:04.45 [kworker/0:2] 1275 root 20 0 157612 2224 1596 R 0.3 0.1 0:00.04 top -c 1 root 20 0 128164 6816 4056 S 0.0 0.4 0:01.72 /usr/lib/systemd/s+ 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] 3 root 20 0 0 0 0 S 0.0 0.0 0:00.12 [ksoftirqd/0] 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 [migration/0] 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh]
[root@localhost ~]# top -bn1 top - 23:19:58 up 1:28, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 89 total, 1 running, 88 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867024 total, 1569512 free, 122532 used, 174980 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1561320 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 128164 6816 4056 S 0.0 0.4 0:01.72 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.12 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H ······ 1103 root 20 0 89544 2088 1076 S 0.0 0.1 0:00.07 master 1104 postfix 20 0 89648 4000 2996 S 0.0 0.2 0:00.02 pickup 1105 postfix 20 0 89716 4020 3016 S 0.0 0.2 0:00.02 qmgr 1187 root 20 0 115388 2044 1648 S 0.0 0.1 0:00.03 bash 1206 root 20 0 145700 5212 3940 S 0.0 0.3 0:00.61 sshd 1210 root 20 0 115392 2124 1688 S 0.0 0.1 0:00.03 bash 1274 root 20 0 0 0 0 S 0.0 0.0 0:00.06 kworker/0:0 1276 root 20 0 157584 2020 1480 R 0.0 0.1 0:00.00 top
监控系统状态多线程
没法打开 /var/log/sa/sa10: 没有那个文件或目录dom
若是sar 不加任何选项,会调用 /var/log/sa 里面保存的历史命令,每十分钟生成一次,由于是刚安装sar 命令,目前尚未历史记录。
[root@localhost ~]# sar -n DEV 1 5 Linux 3.10.0-693.el7.x86_64 (localhost.localdomain) 2018年06月10日 _x86_64_ (1 CPU) 23时33分40秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 23时33分41秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23时33分41秒 ens33 1.01 1.01 0.06 0.18 0.00 0.00 0.00 23时33分41秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 23时33分42秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23时33分42秒 ens33 2.02 2.02 0.12 0.45 0.00 0.00 0.00 23时33分42秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 23时33分43秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23时33分43秒 ens33 0.99 0.99 0.06 0.38 0.00 0.00 0.00 23时33分43秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 23时33分44秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23时33分44秒 ens33 2.02 2.02 0.15 0.45 0.00 0.00 0.00 23时33分44秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 23时33分45秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23时33分45秒 ens33 1.00 1.00 0.06 0.38 0.00 0.00 0.00 平均时间: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 平均时间: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 平均时间: ens33 1.41 1.41 0.09 0.37 0.00 0.00 0.00
- rxpck/s 接收到的数据包 (千之内是正常,上万属于非正常)
- txpck/s 发送的数据包
- rxkB/s 接收的数据量
- txkB/s 发送的数据量
[root@localhost ~]# sar -n DEV -f /var/log/sa/sa10 Linux 3.10.0-693.el7.x86_64 (localhost.localdomain) 2018年06月10日 _x86_64_ (1 CPU) 23时30分01秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 23时40分01秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23时40分01秒 ens33 0.47 0.15 0.03 0.02 0.00 0.00 0.00 平均时间: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 平均时间: ens33 0.47 0.15 0.03 0.02 0.00 0.00 0.00
[root@localhost ~]# sar -q -f /var/log/sa/sa10 ```指定那一天的系统负载 Linux 3.10.0-693.el7.x86_64 (localhost.localdomain) 2018年06月10日 _x86_64_ (1 CPU) 23时30分01秒 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 23时40分01秒 1 107 0.00 0.01 0.05 0 平均时间: 1 107 0.00 0.01 0.05 0 [root[@localhost](https://my.oschina.net/u/570656) ~]# sar -q Linux 3.10.0-693.el7.x86_64 (localhost.localdomain) 2018年06月10日 _x86_64_ (1 CPU) 23时30分01秒 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 23时40分01秒 1 107 0.00 0.01 0.05 0 平均时间: 1 107 0.00 0.01 0.05 0
[root[@localhost](https://my.oschina.net/u/570656) ~]# sar -b Linux 3.10.0-693.el7.x86_64 (localhost.localdomain) 2018年06月10日 _x86_64_ (1 CPU) 23时30分01秒 tps rtps wtps bread/s bwrtn/s 23时40分01秒 0.04 0.00 0.04 0.00 0.58 23时50分01秒 0.05 0.00 0.05 0.00 0.61 平均时间: 0.05 0.00 0.05 0.00 0.60
Device ens33 [192.168.5.130] (1/2): ================================================================================================ Incoming: Curr: 1.39 kBit/s Avg: 1.07 kBit/s Min: 672.00 Bit/s Max: 1.86 kBit/s Ttl: 5.50 MByte Outgoing: Curr: 7.84 kBit/s Avg: 7.89 kBit/s Min: 3.78 kBit/s Max: 8.57 kBit/s Ttl: 2.53 MByte
监控系统状态
[root[@localhost](https://my.oschina.net/u/570656) ~]# iostat -x Linux 3.10.0-693.el7.x86_64 (localhost.localdomain) 2018年06月11日 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 0.13 0.00 0.29 0.21 0.00 99.37 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sda 0.00 0.04 0.98 0.45 27.01 10.94 53.14 0.02 12.71 10.36 17.76 2.74 0.39 scd0 0.00 0.00 0.00 0.00 0.13 0.00 114.22 0.00 15.94 15.94 0.00 13.22 0.00
Total DISK READ : 0.00 B/s | Total DISK WRITE : 0.00 B/s Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 0.00 B/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % systemd --switche~ --deserialize 21 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] 3 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0] 5 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kworker/0:0H] 7 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0] 8 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_bh] 9 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_sched]
[root[@localhost](https://my.oschina.net/u/570656) ~]# free total used free shared buff/cache available Mem: 1867024 124472 1403156 8804 339396 1552288 Swap: 2097148 0 2097148
[root@localhost ~]# free -h total used free shared buff/cache available Mem: 1.8G 121M 1.3G 8.6M 331M 1.5G Swap: 2.0G 0B 2.0G
-ps aux 查看全部进程
[root@localhost ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.3 128164 6824 ? Ss 6月10 0:01 /usr/lib/systemd/systemd --sw root 2 0.0 0.0 0 0 ? S 6月10 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S 6月10 0:00 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S< 6月10 0:00 [kworker/0:0H] root 7 0.0 0.0 0 0 ? S 6月10 0:00 [migration/0] root 8 0.0 0.0 0 0 ? S 6月10 0:00 [rcu_bh] root 9 0.0 0.0 0 0 ? R 6月10 0:00 [rcu_sched] root 10 0.0 0.0 0 0 ? S 6月10 0:00 [watchdog/0] root 12 0.0 0.0 0 0 ? S 6月10 0:00 [kdevtmpfs] ······
[root@localhost ~]# ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 4 S root 1 0 0 80 0 - 32041 ep_pol 6月10 ? 00:00:01 /usr/lib/systemd/sy 1 S root 2 0 0 80 0 - 0 kthrea 6月10 ? 00:00:00 [kthreadd] 1 S root 3 2 0 80 0 - 0 smpboo 6月10 ? 00:00:00 [ksoftirqd/0] 1 S root 5 2 0 60 -20 - 0 worker 6月10 ? 00:00:00 [kworker/0:0H] 1 S root 7 2 0 -40 - - 0 smpboo 6月10 ? 00:00:00 [migration/0] 1 S root 8 2 0 80 0 - 0 rcu_gp 6月10 ? 00:00:00 [rcu_bh] 1 R root 9 2 0 80 0 - 0 - 6月10 ? 00:00:00 [rcu_sched] 5 S root 10 2 0 -40 - - 0 smpboo 6月10 ? 00:00:00 [watchdog/0] 5 S root 12 2 0 80 0 - 0 devtmp 6月10 ? 00:00:00 [kdevtmpfs] ······
- USER :该进程是由哪一个用户产生的
- PID:进程的ID号
- %CPU:该进程占用CPU资源的百分比,占用越高,进程越耗费资源。
- %MEM:该进程占用物理内存的百分比,占用越高,进程越耗费资源。
- VSZ:该进程占用虚拟内存的大小,单位KB。
- RSS: 该进程占用实际物理内存的大小,单位KB.
- TTY: 该进程是在哪一个终端运行的。其中tty1-tty7表明本地控制台终端,tty1-tty6是本地的字符界面终端,tty7是图形终端。pst/0-255表明虚拟终端。
- STAT:进程状态。常见的有:R:运行。 S:睡眠。 T:中止状态。 s:包含子进程。 +:位于后台。
- START:该进程的启动时间
- TIME:该进程占用CPU的运算时间,注意不是系统时间。
- COMMAND:产生此进程的命令名。
[root@localhost ~]# netstat -lnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 886/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1103/master tcp6 0 0 :::22 :::* LISTEN 886/sshd tcp6 0 0 ::1:25 :::* LISTEN 1103/master udp 0 0 127.0.0.1:323 0.0.0.0:* 528/chronyd udp6 0 0 ::1:323 :::* 528/chronyd raw6 0 0 :::58 :::* 7 580/NetworkManager Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 12563 1/systemd /run/systemd/private unix 2 [ ACC ] STREAM LISTENING 19381 1103/master private/verify unix 2 [ ACC ] STREAM LISTENING 19362 1103/master public/qmgr ······
[root@localhost ~]# netstat -an Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 52 192.168.5.130:22 192.168.5.1:55875 ESTABLISHED tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:25 :::* LISTEN udp 0 0 127.0.0.1:323 0.0.0.0:* udp6 0 0 ::1:323 :::* raw6 0 0 :::58 :::* 7
[root@localhost ~]# netstat -ltunp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 886/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1103/master tcp6 0 0 :::22 :::* LISTEN 886/sshd tcp6 0 0 ::1:25 :::* LISTEN 1103/master udp 0 0 127.0.0.1:323 0.0.0.0:* 528/chronyd udp6 0 0 ::1:323 :::* 528/chronyd
[root@localhost ~]# netstat -an | awk '/^tcp/{++sta[$NE]}END{for(key in sta)print key,"\t",sta[key]}' tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1 tcp6 0 0 :::22 :::* LISTEN 1 tcp 0 52 192.168.5.130:22 192.168.5.1:55875 ESTABLISHED 1 tcp6 0 0 ::1:25 :::* LISTEN 1 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1
[root@localhost ~]# tcpdump -nn -i ens33 00:54:51.778716 IP 192.168.5.130.22 > 192.168.5.1.55875: Flags [P.], seq 7403172:7403544, ack 1181, win 264, length 372 00:54:51.780809 IP 192.168.5.130.22 > 192.168.5.1.55875: Flags [P.], seq 7403544:7403708, ack 1181, win 264, length 164 00:54:51.781527 IP 192.168.5.1.55875 > 192.168.5.130.22: Flags [P.], seq 1181:1233, ack 7403544, win 2050, length 52 00:54:51.781576 IP 192.168.5.130.22 > 192.168.5.1.55875: Flags [P.], seq 7403708:7403872, ack 1233, win 264, length 164