#!/bin/bash
Line= ' =========== '
#linux发行版名称
if [[-f/usr/bin/lsb_release]]; Then
os=$ (/usr/bin/lsb_release-a |grep Description |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Else
os=$ (cat/etc/issue |sed-n ' 1p ')
Fi
Echo-e "${line}\nos:\n${os}\n${line}"
######################################################################################################
#查看系统是否为64位: Uname-m, if x86_64 is present, it is 64 digits.
os_version=$ (UNAME-M)
Echo-e "Os_version:\n${os_version}\n${line}"
#系统内核版本
kernel_version=$ (UNAME-R)
Echo-e "Kernel_version:\n${kernel_version}\n${line}"
#cpu型号
cpu=$ (grep ' model name '/proc/cpuinfo |uniq |awk-f: ' {print $} ' |sed ' s/^[', \t]*//g ' |sed ' s/\+/'/g ')
Echo-e "CPU Model:\n${cpu}\n${line}"
#物理cpu个数
counts=$ (grep ' physical id '/proc/cpuinfo |sort |uniq |wc-l)
Echo-e "total of physical Cpu:\n${counts}\n${line}"
#物理cpu内核数
cores=$ (grep ' CPU cores '/proc/cpuinfo |uniq |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Echo-e "Number of CPU Cores\n${cores}\n${line}"
#逻辑cpu个数
processor=$ (grep ' PROCESSOR '/proc/cpuinfo |sort |uniq |wc-l)
ECHO-E "Number of logical Cpus:\n${processor}\n${line}"
#查看CPU当前运行模式是64位还是32位
mode=$ (getconf long_bit)
Echo-e "Present Mode of Cpu:\n${mode}\n${line}"
#查看CPU是否支持64位技术: grep ' flags '/proc/cpuinfo, support for 64-bit if the flags information contains LM fields
numbers=$ (grep ' lm '/proc/cpuinfo |wc-l)
if ((${numbers} > 0)); Then lm=64
else lm=32
Fi
Echo-e "Support Mode of Cpu:\n${lm}\n${line}"
######################################################################
#Memtotal Total Memory Size
total=$ (cat/proc/meminfo |grep ' memtotal ' |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Echo-e "Total Memory:\n${total}\n${line}"
#系统支持最大内存
max_capacity=$ (dmidecode-t memory-q |grep ' Maximum Capacity ' |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Echo-e "Maxinum Memory Capacity:\n${max_capacity}\n${line}"
#查看内存类型, frequency, number, maximum support memory, and other information: dmidecode-t memory, or Dmidecode | Grep-a16 "Memory device$"
#下面为统计内存条数
number=$ (Dmidecode | grep-a16 "Memory device$" |grep size|sort |sed ' s/^[\t]*//g ' | grep-v ' No Module installed ' | wc-l )
ECHO-E "Number of physical Memory:\n${number}\n${line}"
Total size of #SwapTotal swap partition
swaptotal=$ (cat/proc/meminfo |grep ' swaptotal ' |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Echo-e "Total Swap:\n${swaptotal}\n${line}"
#Buffers size
buffers=$ (cat/proc/meminfo |grep ' buffers ' |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Echo-e "Buffers:\n${buffers}\n${line}"
#Cached size
cached=$ (cat/proc/meminfo |grep ' \<cached\> ' |awk-f: ' {print $} ' |sed ' s/^[\t]*//g ')
Echo-e "Cached:\n${cached}\n${line}"
#空闲内存 + Buffers/cache
available=$ (free-m |grep-|awk-f: ' {print $} ' |awk ' {print $} ')
Echo-e "Available memory:\n${available} Mb\n${line}"
#显示硬盘, and size
disk=$ (fdisk-l |grep ' Disk ' |awk-f, ' {print $} ' | sed ' s/disk identifier.*//g ' | sed '/^$/d ')
Echo-e "Amount of Disks:\n${disk}\n${line}"
#各挂载分区使用情况
partion=$ (Df-hlp |sed-n ' 2, $p ')
Echo-e "Usage of Partions:\n${partion}\n${line}"
----------------------------------------------------------------------------------------