Linux小課堂開課了(9)-Centos7日常運維管理

                                  Centos7日常運維管理

1,查看系統配置,進程,I/O,網卡流量
使用w可以查看系統的狀態,當前時間,系統啓動時間,登錄用戶,從哪個IP登錄的,系統的負載值。
Linux小課堂開課了(9)-Centos7日常運維管理
使用uptime查看系統的負載值
Linux小課堂開課了(9)-Centos7日常運維管理
使用iptop,可以具體查看哪個進行使用的I/O較多,需要安裝一下
[root@localhost ~]# yum -y install iotop
[root@localhost ~]# iotop
Linux小課堂開課了(9)-Centos7日常運維管理
使用cat /proc/cpuinfo查看系統配置
Linux小課堂開課了(9)-Centos7日常運維管理
使用vmstat可以查看CPU,內存,虛擬磁盤,交換分區,I/O磁盤和系統進程的信息,加1可以每秒動態顯示一次
Linux小課堂開課了(9)-Centos7日常運維管理
Linux小課堂開課了(9)-Centos7日常運維管理

使用top動態顯示進程,使用top –bn1一次性顯示所有進程信息
Linux小課堂開課了(9)-Centos7日常運維管理
Linux小課堂開課了(9)-Centos7日常運維管理

使用sar可以全面分析系統狀態,需要安裝一下
[root@localhost ~]# yum -y install sysstat
Linux小課堂開課了(9)-Centos7日常運維管理
使用[root@localhost ~]# sar -n DEV 1 3,查看網卡流量的使用情況,每隔一秒顯示一次,共顯示3次
Linux小課堂開課了(9)-Centos7日常運維管理
使用[root@localhost ~]# sar -q 1 3,等同於運行w命令,每隔一秒顯示一次,共顯示3次
Linux小課堂開課了(9)-Centos7日常運維管理
使用[root@localhost ~]# sar -b 1 3可以查看系統磁盤數據信息,每隔一秒顯示一次,共顯示3次
Linux小課堂開課了(9)-Centos7日常運維管理
在安裝sysstat包時,會默認安裝iostat命令,使用iostat可以查看磁盤的使用情況,加1,會每隔一秒動態顯示一次
[root@localhost ~]# iostat
Linux小課堂開課了(9)-Centos7日常運維管理
Linux小課堂開課了(9)-Centos7日常運維管理

後面加-x可以顯示與I/O相關的擴展數據
Linux小課堂開課了(9)-Centos7日常運維管理
使用nload可以監控網卡流量,需要安裝一下,安裝nload命令前要先安裝epel源
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install nload
安裝完成直接運行nload
[root@localhost ~]# nload
Linux小課堂開課了(9)-Centos7日常運維管理

2、查看內存使用情況
使用free,接-m可以以MB爲單位查看數據
Linux小課堂開課了(9)-Centos7日常運維管理
Linux小課堂開課了(9)-Centos7日常運維管理

3、使用ps查看進程,這個日常使用比較多
使用[root@localhost ~]# ps aux查看所有進程
Linux小課堂開課了(9)-Centos7日常運維管理
使用[root@localhost ~]# ps aux | grep httpd查看httpd進程
Linux小課堂開課了(9)-Centos7日常運維管理

4、查看網絡狀態,抓包
使用netstat查看網絡狀態,查看的就是TCP/IP狀態
Linux小課堂開課了(9)-Centos7日常運維管理
使用netstat –lnp查看哪些服務處於監聽狀態
Linux小課堂開課了(9)-Centos7日常運維管理
使用netstat –an查看所有服務的TCP/IP狀態
Linux小課堂開課了(9)-Centos7日常運維管理
使用ss也可以查看服務是否處於監聽狀態,使用ss -tnl | grep查看指定端口是否處於監聽狀態
Linux小課堂開課了(9)-Centos7日常運維管理
Linux小課堂開課了(9)-Centos7日常運維管理

使用tcpdump可以用來抓包,需要安裝一下
[root@localhost ~]# yum -y install tcpdump
[root@localhost ~]# tcpdump -nn -i ens33 -c 10
[root@localhost ~]# tcpdump -nn -i ens33 port 22 -c 10
Linux小課堂開課了(9)-Centos7日常運維管理

還可以指定不要某個端口而指定host
[root@localhost ~]# tcpdump -nn -i ens33 not port 22 and host 192.168.11.10
後接-w,可以把抓取到的數據包存儲到某個文件中
[root@localhost ~]# tcpdump -nn -i ens33 port 22 -c 10 -w /root/tcpdump.txt

Linux小課堂開課了(9)-Centos7日常運維管理
未完,待續~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章