原文: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