1、查看系统内存命令
· 命令概述:
free命令是查看系统内存情况,包含参数如下:
Options:
-b, --bytes show output in bytes
-k, --kilo show output in kilobytes
-m, --mega show output in megabytes
-g, --giga show output in gigabytes
--tera show output in terabytes
--peta show output in petabytes
-h, --human show human-readable output
--si use powers of 1000 not 1024
-l, --lohi show detailed low and high memory statistics
-t, --total show total for RAM + swap
-s N, --seconds N repeat printing every N seconds
-c N, --count N repeat printing N times, then exit
-w, --wide wide output
--help display this help and exit
-V, --version output version information and exit
内存单位:
默认情况下,free命令以千字节(Kilobytes,KB)为单位显示内存大小。
可以使用"-b"参数以字节(Bytes)为单位显示内存大小。
可以使用"-k"参数以千字节为单位显示内存大小。
可以使用"-m"参数以兆字节(Megabytes,MB)为单位显示内存大小。
可以使用"-g"参数以吉字节(Gigabytes,GB)为单位显示内存大小。
内存信息:
总内存(Total):显示系统的总内存大小。
已使用内存(Used):显示当前已被分配和使用的内存大小。
剩余内存(Free):显示当前剩余可用的内存大小。
共享内存(Shared):显示被多个进程共享的内存大小。
缓存(Buffers):显示用于缓存文件系统数据的内存大小。
缓冲区(Cached):显示用于缓冲磁盘写操作的内存大小。
英语不好的就参考如上介绍,显示信息就一目了然了
· 命令实操:
那就一个个的上命令了,跟着贴命令测试亲自体验会很快记住
[root@devlops ~]# clear
[root@devlops ~]# echo '跟上我的步子'
跟上我的步子
[root@devlops ~]# echo '查看内存版本'
查看内存版本
[root@devlops ~]# free -V
free from procps-ng 3.3.10
[root@devlops ~]# echo '查看内存信息,以kb显示'
查看内存信息,以kb显示
[root@devlops ~]# free -k
total used free shared buff/cache available
Mem: 3880252 2459944 113700 644 1306608 1178252
Swap: 0 0 0
[root@devlops ~]# echo '查看内存信息,以Mb显示'
查看内存信息,以Mb显示
[root@devlops ~]# free -m
total used free shared buff/cache available
Mem: 3789 2402 110 0 1275 1150
Swap: 0 0 0
[root@devlops ~]# echo '查看内存信息,以Gb显示'
查看内存信息,以Gb显示
[root@devlops ~]# free -g
total used free shared buff/cache available
Mem: 3 2 0 0 1 1
Swap: 0 0 0
[root@devlops ~]#
2、查看CPU信息命令
· 命令概述:
通过查看/proc/cpuinfo来查看系统cpu详细信息如下:
[root@devlops ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
stepping : 4
microcode : 0x1
cpu MHz : 2500.006
cache size : 33792 KB
physical id : 0
siblings : 2
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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc 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 ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat spec_ctrl intel_stibp
bogomips : 5000.01
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
stepping : 4
microcode : 0x1
cpu MHz : 2500.006
cache size : 33792 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 1
initial apicid : 1
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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc 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 ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat spec_ctrl intel_stibp
bogomips : 5000.01
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
我的是阿里云服务器,配置的核都是虚核,如果有物理机的自己尝试体会
以上输出项的含义如下:
processor :系统中逻辑处理核的编号。对于单核处理器,则课认为是其CPU编号,对于多核处理器则可以是物理核、或者使用超线程技术虚拟的逻辑核
vendor_id :CPU制造商
cpu family :CPU产品系列代号
model :CPU属于其系列中的哪一代的代号
model name:CPU属于的名字及其编号、标称主频
stepping :CPU属于制作更新版本
cpu MHz :CPU的实际使用主频
cache size :CPU二级缓存大小
physical id :单个CPU的标号
siblings :单个CPU逻辑物理核数
core id :当前物理核在其所处CPU中的编号,这个编号不一定连续
cpu cores :该逻辑核所处CPU的物理核数
apicid :用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
fpu :是否具有浮点运算单元(Floating Point Unit)
fpu_exception :是否支持浮点计算异常
cpuid level :执行cpuid指令前,eax寄存器中的值,根据不同的值cupid指令会返回不同的内容
wp :表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
flags :当前CPU支持的功能
bogomips :在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)
clflush size :每次刷新缓存的大小单位
cache_alignment :缓存地址对齐单位
address sizes :可访问地址空间位数
· 命令实操:
[root@devlops ~]#
[root@devlops ~]#
[root@devlops ~]# echo '查看物理CPU的个数'
查看物理CPU的个数
[root@devlops ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
1
[root@devlops ~]# echo '查看物理CPU内核的个数'
查看物理CPU内核的个数
[root@devlops ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores : 1
[root@devlops ~]# echo '查看所有逻辑CPU的个数'
查看所有逻辑CPU的个数
[root@devlops ~]# cat /proc/cpuinfo | grep "processor" | wc -l
2
[root@devlops ~]# echo '查看每个物理CPU中逻辑CPU的个数'
查看每个物理CPU中逻辑CPU的个数
[root@devlops ~]# cat /proc/cpuinfo | grep 'siblings' | uniq
siblings : 2
[root@devlops ~]# echo '查询CPU是否启用超线程'
查询CPU是否启用超线程
[root@devlops ~]# cat /proc/cpuinfo | grep -e "cpu cores" -e "siblings" | sort | uniq
cpu cores : 1
siblings : 2
3、查看磁盘信息命令
· 命令概述:
df 命令主要用于显示 Linux 系统中各文件系统的硬盘使用情况
参数表如下:
| 选 项 | 功 能 |
|---|---|
| -a | 显示所有文件系统信息 |
| -m | 以 MB 为单位显示容量 |
| -k | 以 KB 为单位显示容量,默认以 KB 为单位 |
| -h | 使用人们所熟悉的 KB、MB 或 GB 等单位显示容量 |
| -T | 显示该分区的文件系统名称 |
| -i | 以含有 inode 的数量来显示 |
· 命令实操:
[root@devlops ~]# echo '跟上敲命令'
跟上敲命令
[root@devlops ~]# df -a
文件系统 1K-块 已用 可用 已用% 挂载点
sysfs 0 0 0 - /sys
proc 0 0

本文介绍了Linux系统中查看系统内存、CPU信息、磁盘信息、进程列表和文件列表的命令。详细说明了各命令的参数及含义,如free命令查看内存,可指定单位;通过查看/proc/cpuinfo获取CPU详细信息等,并给出了实操示例。
925

被折叠的 条评论
为什么被折叠?



