#! /bin/bash
#this shell will tell you about computer some info.like kernel,hostname,cpu,hda,IP et.
#show kernel
clear
Kinfo=`uname -r`
echo -e "The linux kernel is: \033[40m \033[31m $Kinfo\033[0m"
Sinfo=`cat /etc/redhat-release`
echo -e "The system is:\033[40m \033[31m $Sinfo\033[0m"
#show hostname
echo -e "The hostname is: \033[40m \033[31m `hostname`\033[0m "
#show CPU information
Cinfo=`cat /proc/cpuinfo |grep "model name"|awk '{print ($7,$8,$10)}'`
echo -e "The cpu is :\033[40m \033[31m $Cinfo\033[0m"
#show disk information
Hinfo=`fdisk -l|grep Disk |head -1|awk '{print ($3,$4)}'`
echo -e "The hard disk have:\033[40m \033[31m $Hinfo\033[0m"
#show IP information
Iinfo=`ifconfig|grep Bcast|awk -F ':' '{print ($2)}'|awk '{print($1)}'`
echo -e "The computer IP is:\033[40m \033[31m $Iinfo\033[0m"
#show memory information
Finfo=`free -m |grep Mem|awk '{print($2)}'`
echo -e "The memory total :\033[40m \033[31m $Finfo M\033[0m"
#show system user
echo -e "The system have the following user(uid>500):"
var=`cat /etc/passwd|awk -F ':' '{print($1n,$3)}'|sed "s/ /./g" `
for word in $var
do
pword=`echo $word|cut -d. -f2`
if [ $pword -ge 500 ];then
echo -e "\033[40m \033[31m `echo $word|cut -d. -f1`\033[0m"
fi
done最后一条读系统的用户遇到了困难,主要是想控制输出UID大于500的用户
现在拿出来到大家分享一下。有好的建议请留言。
lanterns 于 2012-10-14 08:44:45发表:
路过