zoukankan      html  css  js  c++  java
  • 查看系统信息(脚本)

    #!/bin/bash
    #linux.info.sh
    #系统信息查看
    
    [ -f /usr/sbin/dmidecode ] && { dmidecode | grep 'Product Name' |uniq; }
    
    echo 
    if [ -f /etc/redhat-release ];then
        cat /etc/redhat-release
    elif [ -f /etc/lsb-release ];then
        awk -F '"' '/DISTRIB_DESCRIPTION/{print $2}' /etc/lsb-release
    else
        awk -F'"' '/PRETTY_NAME/{print $2}'  /etc/os-release
    fi
    echo "kernel `uname -r`"
    
    echo
    echo "CPU"
    cat /proc/cpuinfo |grep "name" |cut -f2 -d: |uniq
    
    echo "cpu物理个数  `cat /proc/cpuinfo | grep "physical id"| sort| uniq| wc -l`"
    echo "cpu逻辑个数  `cat /proc/cpuinfo| grep "processor"| wc -l`"
    
    echo 
    #echo "内存  `free -g |awk '/Mem/{print $2" G"}'`"
    echo "内存  `free -m |awk '/Mem/{printf ("%.2f
    ", $2/1024)}'`GB"
    #内存数量、频率
    if [ -e /usr/sbin/dmidecode ];then
    dmidecode -t memory |awk '/Size.*MB/{print "条 "$2/1024 "GB"}' |uniq -dc
    dmidecode|grep -A16 "Memory Device"|awk '/Speed.*MHz/{print "频率 "$2 $3}' |uniq -dc
    dmidecode -t memory |awk '/DDR/{print "接口 "$2}' |uniq -dc
    echo "插槽数量    `dmidecode -t memory |grep Size |wc -l`"
    fi
    
    echo 
    echo "Disk"
    lsblk |awk '/disk/{print $1" "$4}'
    df -hlT |egrep '^/dev/|^Filesystem|/$' |egrep -v '^/dev/loop'
    echo 
    
  • 相关阅读:
    CentOS7安装MySQL5.7
    python基础 元组操作
    初识Python Python的历史(转)
    Python基础 基本数据类型
    createEvent 流沙
    GetLogicalDriveStringS获取驱动器根路径 流沙
    监控文件系统用得到的API 流沙
    Windows I/O 操作CreateFile 流沙
    脚本加入域 流沙
    WMI事件 流沙
  • 原文地址:https://www.cnblogs.com/kcxg/p/10473286.html
Copyright © 2011-2022 走看看