首页 > 代码库 > 获取服务器基本信息.sh
获取服务器基本信息.sh
#获取linux服务器基本信息脚本 #!/bin/bash##Name:system_info#Ver:1.0#Author:lykyl###程序说明:#获取服务器基本信息脚本#echo ‘[OS Info]‘echo ‘Host Name: ‘`uname -n`echo ‘OS: ‘`cat /etc/redhat-release`echo ‘Kernel: ‘`uname -r`echoecho ‘[CPU Info]‘echo ‘CPU: physical ‘`grep "physical id" /proc/cpuinfo |uniq |wc -l`‘ cores‘`grep "cpu cores" /proc/cpuinfo |uniq`echoecho ‘[System Info]‘echo `uptime | sed ‘s/^.*load/load/g‘`echo "Zombie:`ps aux |awk ‘{print $8,$2,$11}‘|sed -n ‘/^Z/p‘|wc -l`"echoecho ‘[Memory Info]‘echo `free -m |grep Mem|awk ‘{ print "total:"$2 "MB used:"$3 "MB free:"$4 "MB shared:"$5 "MB buffers:"$6 "MB cached:"$7 "MB" }‘`echoecho ‘[Disk Info]‘echo -e "`df -h|sed ‘1d‘|awk ‘/%/ { if ($6=="") {printf "%s\ttotal:%s\tused:%s\tUse%:%s\n",$5,$1,$2,$4 } else {printf "%s\ttotal:%s\tused:%s\tUse%:%s\n",$6,$2,$3,$5 } }‘`"echoecho ‘[Net Info]‘echo ‘IP: ‘`ifconfig |grep "inet addr:" |grep -v "127.0.0.1"|awk ‘{ print $2 }‘|awk -F: ‘{print $2}‘`echo "netstat: `netstat -an|awk ‘/^tcp/ { ++s[$NF] } BEGIN {ORS=" "} END {for(a in s) print a,s[a]}‘`"
获取服务器基本信息.sh
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。