显示系统信息脚本
作者:互联网
显示系统信息脚本
1 #!/bin/bash
2
3 #================================================================
4 # Copyright (C) 2021 . All rights reserved.
5 #
6 # 文件名称:systeminfo.sh
7 # 创 建 者:gan
8 # 创建日期:2021年04月03日
9
10 # 描 述:
11 #
12 #================================================================
13
14 ECHOPRINT="echo -e "
15 RED=" \e[1;31m"
16 GREEN="\e[1;32m"
17 END="\e[0m"
18 $ECHOPRINT$GREEN"------------------------SysInfo----------"$END
19 $ECHOPRINT$RED"HOSTNAME: `hostname`"$END
20 $ECHOPRINT$RED"IPV4ADDR: `ifconfig ens33 | egrep -o '^[[:space:]]+inet[[:space:]]+[0-9.]+'|egrep -o '[0-9.]+'`"$END
21 $ECHOPRINT$RED"KERNEL_VERSION: `uname -r`"$END
22 $ECHOPRINT$RED"OS_VERSION: `lsb_release -d|tr [[:space:]] ' '|cut -d':' -f2|egrep -o '[^[:space:]].*'`"$END
23 $ECHOPRINT$RED"CPU: `lscpu|egrep '^Model name'|egrep -o 'AMD.*'`"$END
24 $ECHOPRINT$RED"MEM: `free -h|tail -n +2 |head -n1|tr -s ' '|cut -d' ' -f2`"$END
25 $ECHOPRINT$RED"DISK: `lsblk | tail -n +1 | egrep "^sd" | tr -s ' '|cut -d' ' -f1,4|paste -s`"$END
26 $ECHOPRINT$GREEN"------------------------SysInfo----------"$END
标签:脚本,END,space,系统,ECHOPRINT,信息,GREEN,egrep,RED 来源: https://blog.csdn.net/jhh2013/article/details/115416918