#!/bin/bash
#
#********************************************************************
#Author: QH
#QQ: 1625317303
#Date: 2019-03-16
#FileName: sysinfo.sh
#Mail: 1625317303@qq.com
#Description: The test script
#Copyright (C): 2019 All rights reserved
#********************************************************************
BEGINCOLOR="\e[1;35m"
ENDCOLOR="\e[0m"
echo -e "My hostname is ${BEGINCOLOR}`hostname`$ENDCOLOR"
echo -e "IP address is ${BEGINCOLOR}`ifconfig ens33 |grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'|head -n1`$ENDCOLOR"
echo -e "OS version is ${BEGINCOLOR}`cat /etc/redhat-release`$ENDCOLOR"
echo -e "Kernel version is ${BEGINCOLOR}`uname -r`$ENDCOLOR"
echo -e "CPU type is ${BEGINCOLOR}`lscpu|grep "Model name" |cut -d: -f2 |tr -s " "`$ENDCOLOR"
echo -e "Memtotol is ${BEGINCOLOR}`cat /proc/meminfo |head -n1 |grep -Eo '[0-9]+.*'`$ENDCOLOR"
echo -e "Disk space is ${BEGINCOLOR}`lsblk |grep 'sda\>'|grep -Eo '[0-9]+[[:upper:]]'`$ENDCOLOR"
编写脚本 systeminfo.sh,显示当前主机系统信息,包括主机名,IPv4地址, 操作系统版本
原创
©著作权归作者所有:来自51CTO博客作者繁殇残雪的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java 获取当前主机IP 主机名 MAC 操作系统信息
java 获取当前主机IP 主机名 MAC 操作系统信息
职场 休闲 java 获取当前主机IP 主机名 MA -
如何修改Linux操作系统主机名?
Linux;hostname
Linux hostname -
获取指定ip段的所有存活主机的主机名和操作系统
获取指定ip段的所有存活主机的主机名和操作系统
主机名 3c java -
通过主机名(域名)获取IP地址,主机别名等信息
通过主机名(域名)从主机数据库获取主机信息(IP地址,主机别名,标准主机名)
IP #include IPV6