1.系统
1.1版本
uname -a 能确认是64位还是32位,其它的信息不多
[root@ecs-681b ~]
Linux ecs- 681b 3. 10. 0- 1062. 9. 1. el7. x86_64
more /etc/*release 可以看到更多信息
[root@ecs-681b ~]
::::::::::::::
/ etc/ centos- release
::::::::::::::
CentOS Linux release 7. 7. 1908 ( Core)
::::::::::::::
/ etc/ os- release
::::::::::::::
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
::::::::::::::
/ etc/ redhat- release
::::::::::::::
CentOS Linux release 7. 7. 1908 ( Core)
::::::::::::::
/ etc/ system- release
::::::::::::::
CentOS Linux release 7. 7. 1908 ( Core)
1.2核数
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
[root@ecs-681b ~]
4 Intel( R) Xeon( R) CPU E5- 2680 v4 @ 2. 40GHz
cat /proc/cpuinfo | grep physical | uniq -c
[root@ecs-681b ~]
1 physical id : 0
1 address sizes : 42 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 42 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 42 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 42 bits physical, 48 bits virtual
cat /proc/cpuinfo可以看到更为详细的信息
[root@ecs-681b ~]
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel( R) Xeon( R) CPU E5- 2680 v4 @ 2. 40GHz
stepping : 1
microcode : 0x1
cpu MHz : 2394. 456
cache size : 35840 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology 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 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat spec_ctrl intel_stibp flush_l1d
bogomips : 4788. 91
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel( R) Xeon( R) CPU E5- 2680 v4 @ 2. 40GHz
stepping : 1
microcode : 0x1
cpu MHz : 2394. 456
cache size : 35840 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 1
initial apicid : 1
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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology 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 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat spec_ctrl intel_stibp flush_l1d
bogomips : 4788. 91
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel( R) Xeon( R) CPU E5- 2680 v4 @ 2. 40GHz
stepping : 1
microcode : 0x1
cpu MHz : 2394. 456
cache size : 35840 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology 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 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat spec_ctrl intel_stibp flush_l1d
bogomips : 4788. 91
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel( R) Xeon( R) CPU E5- 2680 v4 @ 2. 40GHz
stepping : 1
microcode : 0x1
cpu MHz : 2394. 456
cache size : 35840 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology 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 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat spec_ctrl intel_stibp flush_l1d
bogomips : 4788. 91
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
1.3运行模式
getconf LONG_BIT CPU运行在多少位模式下
[root@ecs-681b ~]
64
cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l 是否支持64位
[root@ecs-681b ~]
1
1.4计算机名
hostname
[root@ecs-681b ~]
ecs- 681b
1.5.查看环境变量
env
[root@ecs-681b ~]
XDG_SESSION_ID=2055
HOSTNAME=ecs- 681b
TERM=xterm
SHELL=/ bin/ bash
HISTSIZE=10000
SSH_CLIENT=124. 116. 213. 125 15654 22
SSH_TTY=/ dev/ pts/ 1
JRE_HOME=/ opt/ java/ jdk1. 8. 0_112/ jre
USER=root
LS_COLORS=rs=0:di=01; 34:ln=01; 36:mh=00:pi=40; 33:so=01; 35:do =01; 35:bd=40; 33; 01:cd=40; 33; 01:or=40; 31; 01:mi =01; 05; 37; 41:su=37; 41:sg=30; 43:ca=30; 41:tw=30; 42:ow=34; 42:st=37; 44:ex=01; 32:* . tar=01; 31:* . tgz=01; 31:* . arc=01; 31:* . arj=01; 31:* . taz=01; 31:* . lha=01; 31:* . lz4=01; 31:* . lzh=01; 31:* . lzma=01; 31:* . tlz=01; 31:* . txz=01; 31:* . tzo=01; 31:* . t7z=01; 31:* . zip=01; 31:* . z=01; 31:* . Z=01; 31:* . dz=01; 31:* . gz=01; 31:* . lrz=01; 31:* . lz=01; 31:* . lzo=01; 31:* . xz=01; 31:* . bz2=01; 31:* . bz=01; 31:* . tbz=01; 31:* . tbz2=01; 31:* . tz=01; 31:* . deb=01; 31:* . rpm=01; 31:* . jar=01; 31:* . war=01; 31:* . ear=01; 31:* . sar=01; 31:* . rar=01; 31:* . alz=01; 31:* . ace=01; 31:* . zoo=01; 31:* . cpio=01; 31:* . 7z=01; 31:* . rz=01; 31:* . cab=01; 31:* . jpg=01; 35:* . jpeg=01; 35:* . gif=01; 35:* . bmp=01; 35:* . pbm=01; 35:* . pgm=01; 35:* . ppm=01; 35:* . tga=01; 35:* . xbm=01; 35:* . xpm=01; 35:* . tif=01; 35:* . tiff=01; 35:* . png=01; 35:* . svg=01; 35:* . svgz=01; 35:* . mng=01; 35:* . pcx=01; 35:* . mov=01; 35:* . mpg=01; 35:* . mpeg=01; 35:* . m2v=01; 35:* . mkv=01; 35:* . webm=01; 35:* . ogm=01; 35:* . mp4=01; 35:* . m4v=01; 35:* . mp4v=01; 35:* . vob=01; 35:* . qt=01; 35:* . nuv=01; 35:* . wmv=01; 35:* . asf=01; 35:* . rm =01; 35:* . rmvb=01; 35:* . flc=01; 35:* . avi=01; 35:* . fli=01; 35:* . flv=01; 35:* . gl =01; 35:* . dl=01; 35:* . xcf=01; 35:* . xwd=01; 35:* . yuv=01; 35:* . cgm=01; 35:* . emf=01; 35:* . axv=01; 35:* . anx=01; 35:* . ogv =01; 35:* . ogx=01; 35:* . aac=01; 36:* . au=01; 36:* . flac=01; 36:* . mid=01; 36:* . midi=01; 36:* . mka=01; 36:* . mp3=01; 36:* . mpc=01; 36:* . ogg=01; 36:* . ra=01; 36:* . wav=01; 36:* . axa=01; 36:* . oga=01; 36:* . spx=01; 36:* . xspf=01; 36:
MAIL=/ var / spool/ mail/ root
PATH=/ opt/ java/ jdk1. 8. 0_112/ bin:/ usr/ local/ sbin:/ usr/ local/ bin:/ usr/ sbin:/ usr/ bin:/ root/ bin
PWD =/ root
JAVA_HOME=/ opt/ java/ jdk1. 8. 0_112
LANG=en_US. UTF- 8
HISTCONTROL=ignoredups
SHLVL=1
HOME=/ root
LOGNAME=root
CLASSPATH=. :/ opt/ java/ jdk1. 8. 0_112/ lib:/ opt/ java/ jdk1. 8. 0_112/ jre/ lib
SSH_CONNECTION=124. 116. 213. 125 15654 192. 168. 1. 111 22
LESSOPEN=| | / usr/ bin/ lesspipe. sh % s
XDG_RUNTIME_DIR=/ run/ user/ 0
HISTTIMEFORMAT=% F % T root
_=/ usr/ bin/ env
1.6系统允许多长时间了/负载数
uptime
[root@ecs-681b ~]
11:53:17 up 79 days, 16:52, 5 users, load average: 0. 17, 0. 14, 0. 14
直接查看平均负载情况 cat /proc/loadavg
[root@ecs-681b ~]
0. 13 0. 13 0. 14 1/ 392 5598
2.资源
2.1内存
cat /proc/meminfo 内存的详细信息
[root@ecs-681b ~]
MemTotal: 8008328 kB
MemFree: 645032 kB
MemAvailable: 3457004 kB
Buffers: 318304 kB
Cached: 2642500 kB
SwapCached: 0 kB
Active: 5865072 kB
Inactive: 1170888 kB
Active( anon) : 4085460 kB
Inactive( anon) : 31572 kB
Active( file) : 1779612 kB
Inactive( file) : 1139316 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 524284 kB
SwapFree: 524284 kB
Dirty: 48 kB
Writeback: 0 kB
AnonPages: 4075176 kB
Mapped: 116608 kB
Shmem: 41880 kB
Slab: 227592 kB
SReclaimable: 199024 kB
SUnreclaim: 28568 kB
KernelStack: 6336 kB
PageTables: 17048 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 4528448 kB
Committed_AS: 5387360 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 20368 kB
VmallocChunk: 34359712252 kB
HardwareCorrupted: 0 kB
AnonHugePages: 2854912 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 235008 kB
DirectMap2M: 5007360 kB
DirectMap1G: 5242880 kB
free -m(-m,单位是m,如果是-g,单位是g)查看可用内存
[root@ecs-681b ~]
total used free shared buff/ cache available
Mem: 7820 4105 629 40 3085 3375
Swap: 511 0 511
3.磁盘和分区
3.1查看各分区使用情况
df -h
[root@ecs-681b ~]
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3. 9G 0 3. 9G 0% / dev
tmpfs 3. 9G 0 3. 9G 0% / dev/ shm
tmpfs 3. 9G 41M 3. 8G 2% / run
tmpfs 3. 9G 0 3. 9G 0% / sys/ fs/ cgroup
/ dev/ vda1 40G 12G 26G 32% /
tmpfs 783M 0 783M 0% / run/ user/ 0
overlay 40G 12G 26G 32% / var / lib/ docker/ overlay2/ e864aa7f691c2e252e11451a25e8ea7d158b056bbaba16c3545250f0fca940ba/ merged
3.2查看指定目录的大小
du -sh <目录名>
[root@ecs-681b ~]
2. 7G / root
3.3查看所有分区
fdisk -l
[root@ecs-681b ~]
Disk / dev/ vda: 42. 9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size ( logical/ physical) : 512 bytes / 512 bytes
I/ O size ( minimum/ optimal) : 512 bytes / 512 bytes
Disk label type : dos
Disk identifier: 0x000af5dd
Device Boot Start End Blocks Id System
/ dev/ vda1 * 2048 83886079 41942016 83 Linux
Disk / dev/ vdb: 322. 1 GB, 322122547200 bytes, 629145600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size ( logical/ physical) : 512 bytes / 512 bytes
I/ O size ( minimum/ optimal) : 512 bytes / 512 bytes
Disk label type : dos
Disk identifier: 0xc434bb17
Device Boot Start End Blocks Id System
/ dev/ vdb1 2048 629143551 314570752 7 HPFS/ NTFS/ exFAT
3.4查看所有交换分区
swapon -s
[root@ecs-681b ~]
Filename Type Size Used Priority
/ swapfile file 524284 0 - 2
4.网络
4.1查看所有网络接口的属性
ifconfig
[root@ecs-681b ~]
docker0: flags=4163<UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
inet 172. 17. 0. 1 netmask 255. 255. 0. 0 broadcast 172. 17. 255. 255
inet6 fe80::42:b9ff:fe98:82e prefixlen 64 scopeid 0x20<link>
ether 02:42:b9:98:08:2e txqueuelen 0 ( Ethernet)
RX packets 242680 bytes 216871271 ( 206. 8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 223999 bytes 109257415 ( 104. 1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
inet 192. 168. 1. 111 netmask 255. 255. 255. 0 broadcast 192. 168. 1. 255
inet6 fe80::f816:3eff:fe34:71f1 prefixlen 64 scopeid 0x20<link>
ether fa:16:3e:34:71:f1 txqueuelen 1000 ( Ethernet)
RX packets 3168418 bytes 1914097091 ( 1. 7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4157278 bytes 1350611602 ( 1. 2 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP, LOOPBACK, RUNNING> mtu 65536
inet 127. 0. 0. 1 netmask 255. 0. 0. 0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 ( Local Loopback)
RX packets 3142990 bytes 449701564 ( 428. 8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3142990 bytes 449701564 ( 428. 8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth16eab8a: flags=4163<UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
inet6 fe80::5897:bdff:fe8b:9b47 prefixlen 64 scopeid 0x20<link>
ether 5a:97:bd:8b:9b:47 txqueuelen 0 ( Ethernet)
RX packets 242598 bytes 220256919 ( 210. 0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 223908 bytes 109251286 ( 104. 1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
4.2 带宽
ethtool 网卡名
[root@ecs-681b ~]
Settings for ens192:
Supported ports: [ TP ]
Supported link modes: 1000baseT/ Full
10000baseT/ Full
Supported pause frame use: No
Supports auto- negotiation: No
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto- negotiation: No
Speed: 10000Mb/ s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto- negotiation: off
MDI- X: Unknown
Supports Wake- on: uag
Wake- on: d
Link detected: yes
4.3查看路由表
route -n
[root@ecs-681b ~]
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0. 0. 0. 0 192. 168. 1. 1 0. 0. 0. 0 UG 100 0 0 eth0
169. 254. 169. 254 192. 168. 1. 1 255. 255. 255. 255 UGH 100 0 0 eth0
172. 17. 0. 0 0. 0. 0. 0 255. 255. 0. 0 U 0 0 0 docker0
192. 168. 1. 0 0. 0. 0. 0 255. 255. 255. 0 U 100 0 0 eth0
4.4查看所有监听端口
netstat -lntp
[root@ecs-681b ~]
Active Internet connections ( only servers)
Proto Recv- Q Send- Q Local Address Foreign Address State PID/ Program name
tcp 0 0 127. 0. 0. 1:21 0. 0. 0. 0:* LISTEN 931/ master
tcp 0 0 0. 0. 0. 0:6379 0. 0. 0. 0:* LISTEN 5692/ redis- server 0
tcp 0 0 0. 0. 0. 0:22 0. 0. 0. 0:* LISTEN 1671/ sshd
tcp6 0 0 :::8080 :::* LISTEN 5889/ java
tcp6 0 0 ::1:25 :::* LISTEN 931/ master
tcp6 0 0 127. 0. 0. 1:8001 :::* LISTEN 5889/ java
tcp6 0 0 127. 0. 0. 1:8002 :::* LISTEN 808/ java
tcp6 0 0 :::3306 :::* LISTEN 7042/ docker- proxy
tcp6 0 0 :::8009 :::* LISTEN 5889/ java
tcp6 0 0 :::8010 :::* LISTEN 808/ java
tcp6 0 0 :::80 :::* LISTEN 808/ java
tcp6 0 0 :::22 :::* LISTEN 1671/ sshd
4.5查看所有已经建立的连接
netstat -antp
[root@ecs-681b ~]
Active Internet connections ( servers and established)
Proto Recv- Q Send- Q Local Address Foreign Address State PID/ Program name
tcp 0 0 0. 0. 0. 0:111 0. 0. 0. 0:* LISTEN 743/ rpcbind
tcp 0 0 0. 0. 0. 0:80 0. 0. 0. 0:* LISTEN 1740/ nginx: master
tcp 0 0 0. 0. 0. 0:81 0. 0. 0. 0:* LISTEN 1740/ nginx: master
tcp 0 0 192. 168. 122. 1:53 0. 0. 0. 0:* LISTEN 2194/ dnsmasq
tcp 0 0 0. 0. 0. 0:22 0. 0. 0. 0:* LISTEN 1543/ sshd
tcp 0 0 127. 0. 0. 1:631 0. 0. 0. 0:* LISTEN 12610/ cupsd
tcp 0 0 0. 0. 0. 0:40536 0. 0. 0. 0:* LISTEN 19964/ rpc. statd
tcp 0 0 127. 0. 0. 1:25 0. 0. 0. 0:* LISTEN 2133/ master
tcp 0 0 172. 31. 4. 233:22 121. 34. 147. 13:57190 ESTABLISHED 29540/ sshd: cavan [
tcp 0 0 172. 31. 4. 233:22 121. 34. 147. 13:54544 ESTABLISHED 27077/ sshd: cavan [
tcp 0 96 172. 31. 4. 233:22 219. 137. 32. 66:60645 ESTABLISHED 30315/ sshd: root@pt
tcp 0 0 172. 31. 4. 233:22 121. 34. 147. 13:56319 ESTABLISHED 28703/ sshd: cavan [
tcp6 0 0 :::111 :::* LISTEN 743/ rpcbind
tcp6 0 0 :::81 :::* LISTEN 1740/ nginx: master
tcp6 0 0 :::22 :::* LISTEN 1543/ sshd
tcp6 0 0 ::1:631 :::* LISTEN 12610/ cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2133/ master
tcp6 0 0 :::35420 :::* LISTEN 19964/ rpc. statd
4.6 某端口使用情况
lsof -i:端口号
[root@ecs-681b ~]
COMMAND PID USER FD TYPE DEVICE SIZE/ OFF NODE NAME
sshd 1150 root 3u IPv4 18264 0t0 TCP * :ssh ( LISTEN)
sshd 1150 root 4u IPv6 18273 0t0 TCP * :ssh ( LISTEN)
sshd 2617 root 3u IPv4 20437 0t0 TCP localhost. localdomain:ssh- >192. 168. 174. 1:60426 ( ESTABLISHED)
netstat -apn|grep 端口号
[root@ecs-681b ~]
tcp 0 0 0. 0. 0. 0:22 0. 0. 0. 0:* LISTEN 1150/ sshd
tcp 0 96 192. 168. 174. 136:22 192. 168. 174. 1:60426 ESTABLISHED 2617/ sshd: root@pts
tcp6 0 0 :::22 :::* LISTEN 1150/ sshd
5.进程
5.1查看所有进程
ps -ef,使用ps -ef|gerp tomcat过滤
[root@ecs-681b ~]
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Feb21 ? 00:14:02 / usr/ lib/ systemd/ systemd -- switched- root -- system -- deserialize 22
root 2 0 0 Feb21 ? 00:00:00 [kthreadd]
root 4 2 0 Feb21 ? 00:00:00 [kworker/0:0H]
root 6 2 0 Feb21 ? 00:00:01 [ksoftirqd/0]
root 7 2 0 Feb21 ? 00:00:00 [migration/0]
root 8 2 0 Feb21 ? 00:00:00 [rcu_bh]
root 9 2 0 Feb21 ? 00:23:47 [rcu_sched]
root 10 2 0 Feb21 ? 00:00:00 [lru-add-drain]
root 11 2 0 Feb21 ? 00:00:19 [watchdog/0]
root 12 2 0 Feb21 ? 00:00:15 [watchdog/1]
ps -aux可以看到进程占用CPU,内存情况
[root@ecs-681b ~]
USER PID % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0. 0 0. 0 191012 4028 ? Ss Feb21 14:02 / usr/ lib/ systemd/ systemd -- switched- root -- system -- deserialize 22
root 2 0. 0 0. 0 0 0 ? S Feb21 0:00 [kthreadd]
root 4 0. 0 0. 0 0 0 ? S< Feb21 0:00 [kworker/0:0H]
root 6 0. 0 0. 0 0 0 ? S Feb21 0:01 [ksoftirqd/0]
root 7 0. 0 0. 0 0 0 ? S Feb21 0:00 [migration/0]
root 8 0. 0 0. 0 0 0 ? S Feb21 0:00 [rcu_bh]
root 9 0. 0 0. 0 0 0 ? S Feb21 23:48 [rcu_sched]
root 10 0. 0 0. 0 0 0 ? S< Feb21 0:00 [lru-add-drain]
root 11 0. 0 0. 0 0 0 ? S Feb21 0:19 [watchdog/0]
5.2实时显示进程状态
top
[root@ecs-681b ~]
top - 11:29:02 up 2:02, 2 users, load average: 0. 12, 0. 04, 0. 05
Tasks: 408 total, 2 running, 406 sleeping, 0 stopped, 0 zombie
% Cpu( s) : 1. 3 us, 0. 3 sy, 0. 0 ni , 98. 3 id, 0. 0 wa, 0. 0 hi, 0. 0 si , 0. 0 st
KiB Mem : 1001332 total, 92184 free, 370332 used, 538816 buff/ cache
KiB Swap: 2097148 total, 2097140 free, 8 used. 419124 avail Mem
PID USER PR NI VIRT RES SHR S % CPU % MEM TIME+ COMMAND
3001 gdm 20 0 1419364 122996 45860 S 1. 0 12. 3 0:06. 50 gnome- shell
276 root 20 0 0 0 0 S 0. 3 0. 0 0:09. 72 kworker/ 0:1
3765 root 20 0 142864 5128 3876 S 0. 3 0. 5 0:00. 77 sshd
7740 root 20 0 146452 2384 1432 R 0. 3 0. 2 0:00. 17 top
1 root 20 0 126124 6792 3912 S 0. 0 0. 7 0:03. 58 systemd
2 root 20 0 0 0 0 S 0. 0 0. 0 0:00. 03 kthreadd
3 root 20 0 0 0 0 S 0. 0 0. 0 0:00. 37 ksoftirqd/ 0
6 root 20 0 0 0 0 S 0. 0 0. 0 0:00. 39 kworker/ u256:0
7 root rt 0 0 0 0 S 0. 0 0. 0 0:00. 00 migration/ 0
6.用户
6.1查看活动用户
w
[root@ecs-681b ~]
11:32:36 up 72 days, 20:50, 3 users, load average: 0. 00, 0. 01, 0. 05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
cavan pts/ 0 121. 34. 147. 13 09:47 1:14m 0. 17s 0. 17s sshd: cavan [priv]
root pts/ 1 219. 137. 32. 66 11:19 4. 00s 0. 05s 0. 00s w
cavan pts/ 3 121. 34. 147. 13 10:14 20:44 0. 38s 0. 11s vim Dockerfile
6.2查看指定用户的信息
id <用户名>
[root@ecs-681b ~]
uid=0( root) gid=0( root) groups=0( root)
[root@ecs-681b ~]
uid=1001( cavan) gid=1001( cavan) groups=1001( cavan)
6.3查看用户登录日志
last
[root@ecs-681b ~]
root pts/ 0 192. 168. 174. 1 Mon Oct 24 09:51 still logged in
( unknown :0 :0 Mon Oct 24 09:27 still logged in
reboot system boot 3. 10. 0- 327. el7. x Mon Oct 24 09:26 - 11:35 ( 02:09)
root pts/ 0 192. 168. 174. 1 Fri Oct 21 09:41 - 18:44 ( 09:03)
( unknown :0 :0 Fri Oct 21 09:15 - 18:44 ( 09:28)
reboot system boot 3. 10. 0- 327. el7. x Fri Oct 21 09:15 - 11:35 ( 3+ 02:20)
root pts/ 1 192. 168. 174. 1 Thu Oct 20 10:05 - 18:13 ( 08:08)
root pts/ 0
6.4查看系统所有用户
cut -d: -f1 /etc/passwd
[root@ecs-681b ~]
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
operator
games
ftp
nobody
systemd- network
dbus
polkitd
postfix
ntp
sshd
tcpdump
dockerroot
mysql
redis