1.系统

1.1版本

uname -a 能确认是64位还是32位,其它的信息不多
[root@ecs-681b ~]# uname -a
Linux ecs-681b 3.10.0-1062.9.1.el7.x86_64
#1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
more /etc/*release 可以看到更多信息
[root@ecs-681b ~]# more /etc/*release
::::::::::::::
/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 ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c4  Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz# 4 个逻辑CPU
cat /proc/cpuinfo | grep physical | uniq -c
[root@ecs-681b ~]#  cat /proc/cpuinfo | grep physical | uniq -c1 physical id    : 01 address sizes  : 42 bits physical, 48 bits virtual1 physical id    : 01 address sizes  : 42 bits physical, 48 bits virtual1 physical id    : 01 address sizes  : 42 bits physical, 48 bits virtual1 physical id    : 01 address sizes  : 42 bits physical, 48 bits virtual# 由4个1核的CPU组成4核
cat /proc/cpuinfo可以看到更为详细的信息
[root@ecs-681b ~]# cat /proc/cpuinfo
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 ~]# getconf LONG_BIT
64
# 如果是32,说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bit
cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l 是否支持64位
[root@ecs-681b ~]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
1
# 结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit

1.4计算机名

hostname
[root@ecs-681b ~]# hostname
ecs-681b

1.5.查看环境变量

env
[root@ecs-681b ~]# env
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 ~]# uptime11:53:17 up 79 days, 16:52,  5 users,  load average: 0.17, 0.14, 0.14# 1.当前时间 11:53:17# 2.系统运行了多少时间,79 days# 3.多少个用户,5 users# 4.平均负载:0.17, 0.14, 0.14,最近1分钟、5分钟、15分钟系统的负载
直接查看平均负载情况 cat /proc/loadavg
[root@ecs-681b ~]# cat /proc/loadavg
0.13 0.13 0.14 1/392 5598
# 除了前3个数字表示平均进程数量外,后面的1个分数,分母表示系统进程总数,分子表示正在运行的进程数;最后一个数字表示最近运行的进程ID

2.资源

2.1内存

cat /proc/meminfo 内存的详细信息
[root@ecs-681b ~]# cat /proc/meminfo
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
# MemTotal总内存,MemFree可用内存
free -m(-m,单位是m,如果是-g,单位是g)查看可用内存
[root@ecs-681b ~]# free -mtotal        used        free      shared  buff/cache   available
Mem:           7820        4105         629          40        3085        3375
Swap:           511           0         511
# 空闲内存total-used=free+buff/cache
# 我们通过free命令查看机器空闲内存时,会发现free的值很小。这主要是因为,在linux中有这么一种思想,内存不用白不用,因此它尽可能的cache和buffer一些数据,以方便下次使用。但实际上这些内存也是可以立刻拿来使用的。

3.磁盘和分区

3.1查看各分区使用情况

df -h
[root@ecs-681b ~]# df -h
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 ~]# du -sh /root
2.7G    /root

3.3查看所有分区

fdisk -l
[root@ecs-681b ~]# fdisk -lDisk /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: 0x000af5ddDevice Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83886079    41942016   83  LinuxDisk /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: 0xc434bb17Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048   629143551   314570752    7  HPFS/NTFS/exFAT

3.4查看所有交换分区

swapon -s
[root@ecs-681b ~]# swapon -s
Filename                Type        Size    Used    Priority
/swapfile                               file    524284  0   -2

4.网络

4.1查看所有网络接口的属性

ifconfig
[root@ecs-681b ~]# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255inet6 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 0TX packets 223999  bytes 109257415 (104.1 MiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.1.111  netmask 255.255.255.0  broadcast 192.168.1.255inet6 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 0TX packets 4157278  bytes 1350611602 (1.2 GiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536inet 127.0.0.1  netmask 255.0.0.0inet6 ::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 0TX packets 3142990  bytes 449701564 (428.8 MiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth16eab8a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet6 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 0TX packets 223908  bytes 109251286 (104.1 MiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

4.2 带宽

ethtool 网卡名
[root@ecs-681b ~]# ethtool ens192
Settings for ens192:Supported ports: [ TP ]Supported link modes:   1000baseT/Full 10000baseT/Full Supported pause frame use: NoSupports auto-negotiation: NoAdvertised link modes:  Not reportedAdvertised pause frame use: NoAdvertised auto-negotiation: NoSpeed: 10000Mb/sDuplex: FullPort: Twisted PairPHYAD: 0Transceiver: internalAuto-negotiation: offMDI-X: UnknownSupports Wake-on: uagWake-on: dLink detected: yes
#看Speed

4.3查看路由表

route -n
[root@ecs-681b ~]# route -n
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 ~]# netstat -lntp
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 ~]# netstat -antp
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 ~]# lsof -i:22
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 ~]# netstat -apn|grep 22
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 ~]# ps -ef
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 ~]# ps -aux
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
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 ~]# w11: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 ~]# id root
uid=0(root) gid=0(root) groups=0(root)
[root@ecs-681b ~]# id cavan
uid=1001(cavan) gid=1001(cavan) groups=1001(cavan)

6.3查看用户登录日志

last
[root@ecs-681b ~]# last
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 ~]#  cut -d: -f1 /etc/passwd
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
operator
games
ftp
nobody
systemd-network
dbus
polkitd
postfix
ntp
sshd
tcpdump
dockerroot
mysql
redis

CentOS7 查询版本/CPU/内存/硬盘容量等命令相关推荐

  1. centOS7下实践查询版本/CPU/内存/硬盘容量等硬件信息

    https://www.cnblogs.com/zy-plan/p/8617202.html 1.系统 1.1版本 uname -a 能确认是64位还是32位,其它的信息不多 [root@localh ...

  2. Linux下查看CPU/内存/硬盘的shell命令

    1.cpu查看 1)cpu个数:#cat /proc/cpuinfo | grep "physical id" | uniq | wc -l 2)cpu核数:#cat /proc/ ...

  3. 【MacOS】Hammerspoon-sugood多合一效率工具,新增状态栏显示系统信息(CPU/内存/硬盘/网速)-v0.1.7

    运行环境要求 已测试可用的系统:MacOS 10.14 及以上 脚本功能说明 Github(国外地址) Gitee(国内地址) 已完成如下功能 状态栏显示输入法状态 时间同步功能 屏幕取色功能 JSO ...

  4. 树莓派-4-温度CPU内存硬盘状态信息

    获取树莓派当前状态和数据(温度.CPU.内存.硬盘) 1 CPU和操作系统信息 1.1 CPU信息 $ sudo cat /proc/cpuinfo $ sudo cat /proc/cpuinfo ...

  5. 处理器仿存带宽_linux服务器CPU内存硬盘读写带宽等性能测试方法

    如何对一个VPS主机进行CPU内存,硬盘IO读写,带宽速度等项目测试,像UnixBench和压力测试则可以综合反映一个VPS的性能水平,方便大家对照参考. VPS性能测试:CPU内存,硬盘IO读写,带 ...

  6. 一个用了统计CPU 内存 硬盘 使用率的shell脚本

    一个用了统计CPU 内存 硬盘 使用率的shell脚本 一个统计 CPU 内存 硬盘 使用率的shell脚本,供大家学习参考 代码如下: #!/bin/bash #This script is use ...

  7. Windows 性能监视器的基本指标说明(CPU,内存,硬盘参数)

    作为一个系统工程师来说,要看懂监控的数据至关重要,关系着优化和分析出现的问题.我是在运维过程中要用到的.因此,今天给出Windows 性能监视器的一些基本指标(CPU,内存,硬盘参数),希望对大家将来 ...

  8. golang 获取cpu 内存 硬盘 使用率 信息 进程信息

    目录 1.获取 cpu 内存 磁盘使用率 2.获取本机信息 3. 获取CPU信息 4. 获取内存信息 5.获取磁盘信息 6.获取网络信息 7. 获取进程信息 使用库: go get github.co ...

  9. Linux CentOs7 监控CPU 内存 硬盘IO读写,网络负载,CPU温度等

    一般我们都知道TOP命令可以加载服务器的负载详情,但界面不太友好.因此用到htop 我们开发的软件服务需要在服务器上运行,所以服务器性能代表了软件的性能上限,因此服务器性能调优是个十分重要的环节,然而 ...

最新文章

  1. 2021年UI设计培训机构哪个好
  2. 德鲁克《新企业》学习收获
  3. 如何在Markdown中链接到同一文档的一部分?
  4. struts-2.5.14.1 中web.xml的基本配置
  5. DevExpress ASP.NET 使用经验谈(9)-Dev控件客户端事件 ClientSideEvents
  6. 切换tab页时,tab页中的echart变形问题
  7. 音视频技术开发周刊 90期
  8. UML类图的6大关系
  9. 去掉WINDOWS SERVER 开机按CTRL+ALT+DEL登陆的方法
  10. Python 文本挖掘:使用gensim进行文本相似度计算
  11. 解决APKIDE(APK改之理)运行出现ApkIDE Exception:…报错的问题
  12. 微信个人名片H5生成器
  13. Vivado使用系列:使用自定义BD
  14. 程序员相亲被大三岁的富婆姐姐看上,让他当《杭州赘婿》
  15. linux下打包C++ Qt可执行程序出现的问题总结
  16. WebStorm/IDEA 激活证书服务器
  17. Mysql| order by 排序检索数据(ASC,DESC)
  18. 二十 关于gmtime、gmtime_r、localtime、localtime_r
  19. 酒水行业数字化转型解决方案
  20. 任意地址读写驱动提权(cred、VDSO、modprobe_path、core_pattern、修改内核指针提权)

热门文章

  1. Cookie编程基础:检查浏览器是否接受Cookie
  2. AcWing 616. 两点间的距离
  3. trace系列0 - 概述
  4. NEC红外线解码协议
  5. 求解两圆相交的交点坐标
  6. [MTK] 平板项目,进入工程模式
  7. GIF转MP4 - 在线将GIF动态图转为MP4视频文件
  8. Cookie的修改、删除,清除
  9. 精读《Prisma 的使用》
  10. Python爬虫之实现百度翻译