原文:https://blog.csdn.net/pwb1994001/article/details/80896267java
参考:https://blog.csdn.net/dream_broken/article/details/52883883 参考:https://blog.csdn.net/lampsunny/article/details/6288457
① 确认是64位仍是32位,其余信息很少mysql
$ uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
② 看到更多信息linux
$ more /etc/*release :::::::::::::: /etc/centos-release :::::::::::::: CentOS Linux release 7.2.1511 (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.2.1511 (Core) :::::::::::::: /etc/system-release :::::::::::::: CentOS Linux release 7.2.1511 (Core)
总核数 = 物理CPU个数 × 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 × 每颗物理CPU的核数 × 超线程数
① 查看物理CPU个数nginx
$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 1
② 查看每颗物理CPU中core的个数(即核数)redis
$ cat /proc/cpuinfo | grep "cpu cores" | uniq cpu cores : 8
③ 查看逻辑CPU的个数sql
$ cat /proc/cpuinfo | grep "processor" | wc -l 16
④ 查看CPU信息(型号)docker
$ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 16 Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz
⑤ 查看CPU详细信息centos
$ cat /proc/cpuinfo
processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 63 model name : Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz stepping : 2 microcode : 0x3c cpu MHz : 2900.028 cache size : 25600 KB physical id : 0 siblings : 16 core id : 0 cpu cores : 8 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 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 fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt bogomips : 5800.05 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management:
① 查看CPU运行在多少位模式下api
$ getconf LONG_BIT 64
② 若是是32,说明当前CPU运行在32bit模式下,但不表明CPU不支持64bitruby
$ cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l 16
结果大于0,说明支持64bit计算,lm指long mode,支持lm则是64bit
① 计算机名
$ hostname localhost.localdomain
① 环境变量
$ env
XDG_SESSION_ID=4 HOSTNAME=localhost.localdomain SELINUX_ROLE_REQUESTED= TERM=vt100 SHELL=/bin/bash HISTSIZE=1000 SSH_CLIENT=192.168.174.1 58896 22 SELINUX_USE_CURRENT_RANGE= SSH_TTY=/dev/pts/0 USER=root
① 系统运行时间
$ uptime
02:16:07 up 36 days, 27 min, 7 users, load average: 1.38, 1.36, 1.34
02:16:07 // 系统当前时间 up 36 days, 27 min // 主机已运行时间,36天27分钟,时间越大,说明你的机器越稳定。 7 users // 用户链接数,是总链接数而不是用户数 load average: 1.38, 1.36, 1.34 // 系统平均负载,统计最近1,5,15分钟的系统平均负载
② 查看平均负载
$ cat /proc/loadavg 1.80 1.53 1.41 4/3909 4106
前面三个值分别对应系统当前1分钟、5分钟、15分钟内的平均load;
后面的1个分数,分母表示系统进程总数,分子表示正在运行的进程数;
最后一个数字表示最近运行的进程ID。
① 内存详细信息
$ cat /proc/meminfo
MemTotal: 30440564 kB MemFree: 1292332 kB MemAvailable: 9045208 kB Buffers: 788 kB Cached: 8805368 kB SwapCached: 0 kB Active: 23305524 kB Inactive: 4361900 kB Active(anon): 19620352 kB Inactive(anon): 869288 kB Active(file): 3685172 kB Inactive(file): 3492612 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 1396 kB Writeback: 0 kB AnonPages: 18861432 kB Mapped: 281464 kB Shmem: 1628228 kB Slab: 1021668 kB SReclaimable: 828508 kB SUnreclaim: 193160 kB KernelStack: 66336 kB PageTables: 84196 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 15220280 kB Committed_AS: 36287560 kB VmallocTotal: 34359738367 kB VmallocUsed: 83692 kB VmallocChunk: 34359493624 kB HardwareCorrupted: 0 kB AnonHugePages: 15896576 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 284672 kB DirectMap2M: 22784000 kB DirectMap1G: 8388608 kB
MemTotal总内存,MemFree可用内存
② 查看可用内存(-m,单位是m,-g,单位是g)
$ free -m
total used free shared buff/cache available
Mem: 29727 18867 1248 1598 9611 8825 Swap: 0 0 0 $ free -g total used free shared buff/cache available Mem: 29 18 1 1 9 8 Swap: 0 0 0
空闲内存:total - used = free + buff/cache
咱们经过free命令查看机器空闲内存时,会发现free的值很小。这主要是由于,在linux中有这么一种思想,内存不用白不用,所以它尽量的cache和buffer一些数据,以方便下次使用。但实际上这些内存也是能够马上拿来使用的。
① 查看各分区使用状况
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 45G 22G 24G 48% / devtmpfs 906M 0 906M 0% /dev tmpfs 921M 96K 921M 1% /dev/shm tmpfs 921M 1004K 920M 1% /run tmpfs 921M 0 921M 0% /sys/fs/cgroup /dev/sda1 497M 195M 303M 40% /boot tmpfs 185M 0 185M 0% /run/user/1001 tmpfs 185M 0 185M 0% /run/user/0
② 查看指定目录的大小
$ du -sh /root 1.2G /root
③ 查看全部分区
$ fdisk -l
磁盘 /dev/sda:32.2 GB, 32212254720 字节,62914560 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0x000a0cd4 设备 Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 62914559 30944256 8e Linux LVM 磁盘 /dev/mapper/centos-root:29.5 GB, 29490151424 字节,57597952 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/centos-docker--poolmeta:33 MB, 33554432 字节,65536 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/docker-253:0-101330881-pool:107.4 GB, 107374182400 字节,209715200 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):65536 字节 / 65536 字节
④ 查看全部交换分区
$ swapon -s 文件名 类型 大小 已用 权限 /dev/dm-1 partition 2097148 8 -1
① 查看全部网络接口的属性
$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0 ether 02:42:e1:b8:a5:4f txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.174.129 netmask 255.255.255.0 broadcast 192.168.174.255 inet6 fe80::20c:29ff:fe50:b3b4 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:50:b3:b4 txqueuelen 1000 (Ethernet) RX packets 28649 bytes 38411280 (36.6 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 8937 bytes 1226914 (1.1 MiB) 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 0 (Local Loopback) RX packets 4 bytes 340 (340.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4 bytes 340 (340.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 00:00:00:00:00:00 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
② 带宽
$ ethtool ens192(网卡名)
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
主要查看speed
③ 查看路由表
$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.31.16.1 0.0.0.0 UG 0 0 0 eth0 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-b3fca78f9ec2 172.31.16.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
④ 查看全部监听端口
$ netstat -ntpl 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:10248 0.0.0.0:* LISTEN 48609/kubelet tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 112434/java tcp 0 0 127.0.0.1:10249 0.0.0.0:* LISTEN 15725/kube-proxy tcp 0 0 172.31.24.20:10250 0.0.0.0:* LISTEN 48609/kubelet tcp 0 0 127.0.0.1:50090 0.0.0.0:* LISTEN 112806/java tcp 0 0 0.0.0.0:26380 0.0.0.0:* LISTEN 119314/redis-sentin tcp 0 0 0.0.0.0:6380 0.0.0.0:* LISTEN 121036/./redis-serv tcp 0 0 0.0.0.0:26381 0.0.0.0:* LISTEN 126277/redis-sentin tcp 0 0 0.0.0.0:6381 0.0.0.0:* LISTEN 94302/redis-server tcp 0 0 0.0.0.0:26382 0.0.0.0:* LISTEN 130400/redis-sentin tcp 0 0 0.0.0.0:6382 0.0.0.0:* LISTEN 70223/redis-server tcp 0 0 0.0.0.0:17070 0.0.0.0:* LISTEN 9519/nginx: master tcp 0 0 172.31.24.20:10255 0.0.0.0:* LISTEN 48609/kubelet tcp 0 0 0.0.0.0:20880 0.0.0.0:* LISTEN 80641/java tcp 0 0 0.0.0.0:19888 0.0.0.0:* LISTEN 9519/nginx: master tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 39892/java tcp