linux查询Centos服务器资源配置和使用情况

目录

1.查询内存

2.查询存储

3.查询cpu信息

4.cpu个数

5.查看cpu核心数

6.查看线程总数

7.查看系统32位还是64位及系统架构


1.查询内存

free -h

Mem:表示物理内存统计,如果机器剩余内存非常小,一般小于总内存的20%,则判断为系统物理内存不够   
​
Swap: 表示硬盘上交换分区的使用情况,如剩余空间较小,需要留意当前系统内存使用情况及负载,当Swap的used值大于0时,则表示操作系统物理内存不够,已经开始使用硬盘内存了。
​
 第1行数据11G表示物理内存总量;6.5G表示总计分配给缓存(包含buffers与cache)使用的数量,但其中可能部分缓存并未实际使用; 1.3G表示未被分配的内存;shared表示共享内存;4.0G表示系统分配但未被使用的buffers数量;4.7G表示系统分配但未被使用的available数量   

free   -h
              total        used        free      shared  buff/cache   available
Mem:           7.6G        1.9G        2.1G        173M        3.6G        5.2G
Swap:          3.9G        135M        3.7G
​
​
              total        used        free      shared  buff/cache   available
Mem:           3.7G        2.4G        479M        191M        898M        954M
​

2.查询存储

df -hl


df -hl
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  193M  1.7G  11% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   50G  8.8G   42G  18% /
/dev/mapper/centos-home   46G   33M   46G   1% /home
/dev/sda1               1014M  150M  865M  15% /boot
/dev/loop0               4.5G  4.5G     0 100% /mnt/cdrom
tmpfs                    379M     0  379M   0% /run/user/1000

3.查询cpu信息

lscpu

# 总览
$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             4
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
Stepping:              1
CPU MHz:               2199.998
BogoMIPS:              4399.99
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              25600K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf 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 epb invpcid_single fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt dtherm ida arat pln pts

4.cpu个数

cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l

[root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
1
[root@localhost ~]# 


5.查看cpu核心数
 

cat /proc/cpuinfo | grep "cpu cores" | uniq

[root@localhost ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores	: 1
[root@localhost ~]# 

6.查看线程总数
 

cat /proc/cpuinfo | grep "processor" | wc -l

[root@localhost ~]# cat /proc/cpuinfo | grep "processor" | wc -l
1
[root@localhost ~]# 

7.查看系统32位还是64位及系统架构

# 下面三个命令挨个执行看看,总有一个适合

getconf LONG_BIT

dpkg --print-architecture

arch
 

[root@localhost ~]# arch
x86_64
[root@localhost ~]# 



[root@localhost ~]# getconf LONG_BIT
64
[root@localhost ~]# 


[root@localhost ~]# dpkg --print-architecture
-bash: dpkg: 未找到命令
[root@localhost ~]# 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值