共计 3829 个字符,预计需要花费 10 分钟才能阅读完成。
1:uname
$ uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type or "unknown"
-i, --hardware-platform print the hardware platform or "unknown"
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'uname invocation'
罕用
# 显示所有
$ uname -a
# 硬件平台
$ uname -i
x86_64
# 内核版本号
$ uname -r
3.10.0-229.el7.x86_64
$ uname -v
#1 SMP Fri Mar 6 11:36:42 UTC 2015
2:/proc/version
零碎运行内核版本号以及 gcc 版本号
$ cat /proc/version
Linux version 3.10.0-229.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 6 11:36:42 UTC 2015
3:/proc/cpuinfo
cpu 相干信息
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 94
model name : Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz
stepping : 3
cpu MHz : 2711.952
cache size : 6144 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
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 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed
bogomips : 5423.90
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
常见命令
# 查看物理 cpu 个数
$ cat /proc/cpuinfo| grep "physical id" |sort | uniq | wc -l
4
# 查看每个物理 cpu 的核数
$ cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 1
# 查看逻辑 cpu 个数
$ cat /proc/cpuinfo| grep "processor"| wc -l
4
4: lscpu
Display information about the CPU architecture.
lscpu 从 sysfs 和 /proc/cpuinfo 收集 cpu 体系结构信息,命令的输入比拟易读
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz
Stepping: 3
CPU MHz: 2711.952
BogoMIPS: 5423.90
Hypervisor vendor: Oracle
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed
5: /proc/meminfo
零碎内存应用情况
free 和 vmstat 等命令返回数据均来自该文件
具体介绍 参考这里
6: free
Display amount of free and used memory in the system
$ free -h
total used free shared buff/cache available
Mem: 3.7G 119M 3.3G 8.5M 296M 3.4G
Swap: 2.0G 0B 2.0G
7:/proc/uptime 和 /proc/loadavg
零碎运行工夫和空间工夫 单位 s
(闲暇工夫可能会是运行工夫的几倍 因为闲暇工夫是所有逻辑 cpu 的闲暇工夫和)
$cat /proc/uptime
70642.00 282514.43
$ cat /proc/loadavg
0.00 0.01 0.05 1/170 15387
8:uptime
$ uptime
15:22:35 up 19:41, 1 user, load average: 0.00, 0.01, 0.05
别离示意
- 以后工夫 15:22:35
- 零碎曾经运行工夫 19:41 19 小时 41 分
- 以后在线用户数 1 个用户
- 零碎负载 1 分钟 5 分钟 15 分钟平均值
9:查看零碎发行版
/etc/os-release
$ cat /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"
lsb_release
$ lsb_release -r
Release: 7.2.1511
该命令默认没有被装置 须要自行装置
/etc/issue
hostnamectl
$ hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 15ef07d6ca494a7f82fec477fa70b7e4
Boot ID: 1b607797966a487b8b72944f0ce619c2
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
正文完