Linux命令学习1203

更新yum源

cd /ect/yum.repos.d/CentOS-Base.repo
mv  /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo.backup

wget -O  /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.aliyun.com/repo/Centos-7.repo

yum makecache

yum -y update

Linux系统监控命令

  1. top命令
top - 14:10:24 up 83 days, 22:45,  1 user,  load average: 0.00, 0.03, 0.05
Tasks: 105 total,   1 running, 104 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  3.1 sy,  0.0 ni, 96.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1014856 total,   115416 free,   508424 used,   391016 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   358212 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1882 root      20   0  159940   2096   1472 R   6.2  0.2   0:00.01 top
    1 root      20   0  128196   5360   2732 S   0.0  0.5  10:39.84 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:01.59 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:06.67 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:12.07 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   2:12.40 rcu_sched
   10 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 lru-add-drain
   11 root      rt   0       0      0      0 S   0.0  0.0   0:28.64 watchdog/0
   12 root      rt   0       0      0      0 S   0.0  0.0   0:21.85 watchdog/1
   13 root      rt   0       0      0      0 S   0.0  0.0   0:11.15 migration/1
   14 root      20   0       0      0      0 S   0.0  0.0   0:05.78 ksoftirqd/1
   16 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1:0H
   18 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kdevtmpfs
   19 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 netns
   20 root      20   0       0      0      0 S   0.0  0.0   0:02.45 khungtaskd
   21 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 writeback
   22 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kintegrityd
   23 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
   24 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
   25 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset
   26 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kblockd
   27 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 md
   28 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 edac-poller
   29 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 watchdogd
   36 root      20   0       0      0      0 S   0.0  0.0   1:32.96 kswapd0
   37 root      25   5       0      0      0 S   0.0  0.0   0:00.00 ksmd

参数: M,t

  1. vmstat命令
[root@instance-1 openvpn]# vmstat 2 10
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 267344      0 256004    0    0     9     4    2    0  0  0 100  0  0
 0  0      0 267344      0 256024    0    0     0     0  193  274  0  0 100  0  0

参数解释:2表示间隔时间,10表示次数