圆月山庄资源网 Design By www.vgjia.com

此脚本已经在ubuntu以及centos版本上测试通过,脚本如下:
复制代码 代码如下:
#!/bin/bash

Line='==========='

#linux发行版名称
if [[ -f /usr/bin/lsb_release ]]; then
OS=$(/usr/bin/lsb_release -a |grep Description |awk -F : '{print $2}' |sed 's/^[ \t]*//g')
else
OS=$(cat /etc/issue |sed -n '1p')
fi

echo -e "${Line}\nOS:\n${OS}\n${Line}"

######################################################################################################

#查看系统是否为64位:uname -m,若出现x86_64,则为64位
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 $2}' |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 $2}' |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,若flags信息中包含lm字段,则支持64位
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=$(cat /proc/meminfo |grep 'MemTotal' |awk -F : '{print $2}' |sed 's/^[ \t]*//g')
echo -e "Total Memory:\n${Total}\n${Line}"

#系统支持最大内存
Max_Capacity=$(dmidecode -t memory -q |grep 'Maximum Capacity' |awk -F : '{print $2}' |sed 's/^[ \t]*//g')
echo -e "Maxinum Memory Capacity:\n${Max_Capacity}\n${Line}"

#查看内存类型、频率、条数、最大支持内存等信息:dmidecode -t memory,或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}"


#SwapTotal swap分区总大小
SwapTotal=$(cat /proc/meminfo |grep 'SwapTotal' |awk -F : '{print $2}' |sed 's/^[ \t]*//g')
echo -e "Total Swap:\n${SwapTotal}\n${Line}"

#Buffers size
Buffers=$(cat /proc/meminfo |grep 'Buffers' |awk -F : '{print $2}' |sed 's/^[ \t]*//g')
echo -e "Buffers:\n${Buffers}\n${Line}"

#Cached size
Cached=$(cat /proc/meminfo |grep '\<Cached\>' |awk -F : '{print $2}' |sed 's/^[ \t]*//g')
echo -e "Cached:\n${Cached}\n${Line}"

#空闲内存 + buffers/cache
Available=$(free -m |grep - |awk -F : '{print $2}' |awk '{print $2}')
echo -e "Available Memory:\n${Available} MB\n${Line}"

#显示硬盘,以及大小
Disk=$(fdisk -l |grep 'Disk' |awk -F , '{print $1}' | 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}"

----------------------------------------------------------------------------------------
测试结果展示:
复制代码 代码如下:
===========
OS:
Red Hat Enterprise Linux Server release 5.6 (Tikanga)
===========
OS_version:
i686
===========
Kernel_version:
2.6.18-238.el5
===========
CPU model:
AMD A6-3400M APU with Radeon(tm) HD Graphics
===========
Total of physical CPU:
2
===========
Number of CPU cores
2
===========
Number of logical CPUs:
4
===========
Present Mode Of CPU:
32
===========
Support Mode Of CPU:
64
===========
Total Memory:
514744 kB
===========
Maxinum Memory Capacity:
1024 GB
===========
Number of Physical Memory:
1
===========
Total Swap:
1044216 kB
===========
Buffers:
101936 kB
===========
Cached:
267356 kB
===========
Available Memory:
369 MB
===========
Amount Of Disks:
Disk /dev/sda: 107.3 GB
===========
Usage Of partions:
/dev/sda3 96G 4.6G 87G 6% /
/dev/sda1 99M 12M 83M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
/dev/hdc 3.0G 3.0G 0 100% /media/RHEL_5.6 i386 DVD
===========

标签:
获取服务器信息,Shell脚本

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。