码迷,mamicode.com
首页 > 系统相关 > 详细

Linux显示系统信息sh脚本

时间:2020-04-01 12:53:01      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:显示   copyright   url   信息   auth   bash   lin   www   filename   

#!/bin/bash
#
#********************************************************************
#Author:                wangxiaochun
#QQ:                    29308620
#Date:                  2020-04-01
#FileName:             system_info.sh
#URL:                   http://www.magedu.com
#Description:          The test script
#Copyright (C):         2020 All rights reserved
#********************************************************************
RED="\E[1;31m"
GREEN="\E[1;32m"
END="\E[0m"
echo -e "$GREEN----------------------Host systeminfo--------------------$END"
echo -e  "HOSTNAME:     $RED`hostname`$END"
echo -e  "IPADDR:       $RED` ifconfig eth0|grep -Eo ‘([0-9]{1,3}\.){3}[0-9]{1,3}‘ |head -n1`$END"
echo -e  "OSVERSION:    $RED`cat /etc/redhat-release`$END"
echo -e  "KERNEL:       $RED`uname -r`$END"
echo -e  "CPU:         $RED`lscpu|grep ‘Model name‘|tr -s ‘ ‘|cut -d : -f2`$END"
echo -e  "MEMORY:       $RED`free -h|grep Mem|tr -s ‘ ‘ : |cut -d : -f2`$END"
echo -e  "DISK:         $RED`lsblk |grep ‘^sd‘ |tr -s ‘ ‘ |cut -d " " -f4`$END"
echo -e "$GREEN---------------------------------------------------------$END"
#!/bin/bash
#
#********************************************************************
#Author:                wangxiaochun
#QQ:                    29308620
#Date:                  2020-04-01
#FileName:             system_info.sh
#URL:                   http://www.magedu.com
#Description:          The test script
#Copyright (C):         2020 All rights reserved
#********************************************************************
RED="\E[1;31m"
GREEN="\E[1;32m"
END="\E[0m"
echo -e "$GREEN----------------------Host systeminfo--------------------$END"
echo -e  "HOSTNAME:     $RED`hostname`$END"
echo -e  "IPADDR:       $RED` ifconfig eth0|grep -Eo ‘([0-9]{1,3}\.){3}[0-9]{1,3}‘ |head -n1`$END"
echo -e  "OSVERSION:    $RED`cat /etc/redhat-release`$END"
echo -e  "KERNEL:       $RED`uname -r`$END"
echo -e  "CPU:         $RED`lscpu|grep ‘Model name‘|tr -s ‘ ‘|cut -d : -f2`$END"
echo -e  "MEMORY:       $RED`free -h|grep Mem|tr -s ‘ ‘ : |cut -d : -f2`$END"
echo -e  "DISK:         $RED`lsblk |grep ‘^sd‘ |tr -s ‘ ‘ |cut -d " " -f4`$END"
echo -e "$GREEN---------------------------------------------------------$END"

Linux显示系统信息sh脚本

标签:显示   copyright   url   信息   auth   bash   lin   www   filename   

原文地址:https://www.cnblogs.com/bpzblog/p/12611682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!