#!/bin/bash #CPU逻辑个数 cpu_processor=$(cat /proc/cpuinfo | grep processor | wc -l) #CPU物理个数 cpu_num=$(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l) #物理内存 server_memory=$(cat /proc/meminfo | grep "MemTotal" | awk '{print $2/1024/1024}') #GB disk_GB=$(df -P -B 1m | awk '{print $2}' | grep -v '[^0-9]' | awk NF | awk 'BEGIN {count=0;} {count=count+$0;} END{print count/1024}') printf "CPU逻辑个数:%s CPU物理个数: %s 物理内存: %s 磁盘容量:%s " $cpu_processor $cpu_num $server_memory $disk_GB