RucLinux system information

2014年03月14日

原创内容,转载请注明出处:http://www.myzhenai.com.cn/post/1777.html http://www.myzhenai.com/thread-16179-1-1.html
这是写的一个shell脚本,获取linux系统的信息并保存为一个php文件.方法其实很简单.将以下内容保存为script.sh文件即可.
演示:https://www.dropbox.com/s/qlt4e6jwuy3tbzj/sinof.php

# !/bin/bash
rm -rf sinof.php
echo "<html>" >> sinof.php
echo "<head>" >> sinof.php
echo '<meta charset="utf-8"/><title>RucLinux system information script</title>' >> sinof.php
echo "<body>" >> sinof.php
echo '<a href="http://www.myzhenai.com.cn">myzhenai.com.cn</a>  <a href="http://www.myzhenai.com">myzhenai.com</a> <a href="http://www.haikou-china.com">haikou-china.com</a> <a href="http://jiayu.mybabya.com">jiayu.mybabya.com</a><br />' >> sinof.php
echo "<b>The local time:</b><br />" >> sinof.php
date -u >> sinof.php
echo "<br />" >> sinof.php
echo "<b>The current working directory:</b><br />" >> sinof.php
pwd >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Kernel/operating system/CPU Information:</b><br />" >> sinof.php
uname -a >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Kernel version:</b><br />" >> sinof.php
cat /proc/version >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Operating System Version:</b><br />" >> sinof.php
cat /etc/issue >> sinof.php
echo "<br />" >> sinof.php
echo "<b>CPU information:</b><br />" >> sinof.php
cat /proc/cpuinfo >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Loaded kernel modules:</b><br />" >> sinof.php
lsmod >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Environment variables:</b><br />" >> sinof.php
env >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Memory usage:</b><br />" >> sinof.php
free -m >> sinof.php
echo "<br />" >> sinof.php
echo "<b>The amount of memory:</b><br />" >> sinof.php
grep MemTotal /proc/meminfo >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Free memory:</b><br />" >> sinof.php
grep MemFree /proc/meminfo >> sinof.php
echo "<br />" >> sinof.php
echo "<b>System uptime:</b><br />" >> sinof.php
uptime >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All partitions:</b><br />" >> sinof.php
fdisk -l >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All swap partitions:</b><br />" >> sinof.php
swapon -s >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All network interfaces:</b><br />" >> sinof.php
ifconfig >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Routing table:</b><br />" >> sinof.php
route -n >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All listening ports:</b><br />" >> sinof.php
netstat -lntp >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Connection has been established:</b><br />" >> sinof.php
netstat -antp >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Network Statistics processes:</b><br />" >> sinof.php
netstat -s >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All processes:</b><br />" >> sinof.php
ps -ef >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Active users:</b><br />" >> sinof.php
w -s >> sinof.php
echo "<br />" >> sinof.php
echo "<b>User login log:</b><br />" >> sinof.php
last >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All users of the system:</b><br />" >> sinof.php
cut -d: -f1 /etc/passwd >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All group:</b><br />" >> sinof.php
cut -d: -f1 /etc/group >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Plan of the current user:</b><br />" >> sinof.php
crontab -l >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All system services:</b><br />" >> sinof.php
chkconfig --list >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All activated system service:</b><br />" >> sinof.php
chkconfig --list |grep on >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All software installed packages:</b><br />" >> sinof.php
rpm -qa >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All installed PHP software package:</b><br />" >> sinof.php
rpm -qa |grep php >> sinof.php
echo "<br />" >> sinof.php
echo "<b>PHP information:</b><br />" >> sinof.php
php -v >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All php.ini file path:</b><br />" >> sinof.php
find / -name php.ini >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All httpd.conf file path:</b><br />" >> sinof.php
find / -name httpd.conf >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All lighttpd.conf file path:</b><br />" >> sinof.php
find / -name ligbttpd.conf >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All nginx.conf file path:</b><br />" >> sinof.php
find / -name nginx.conf >> sinof.php
echo "<br />" >> sinof.php
echo "<b>All php-fpm.conf file path:</b><br />" >> sinof.php
find / -name php-fpm.conf >> sinof.php
echo "<br />" >> sinof.php
echo "<b>The current system of open files:</b><br />" >> sinof.php
lsof -i >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Find the ASP file:</b><br />" >> sinof.php
find / -name *.asp >> sinof.php
echo "<br />" >> sinof.php
echo "<b>Volume files larger than 10M:</b><br />" >> sinof.php
find / -size +10M >> sinof.php
echo "<br />" >> sinof.php
echo "</body>" >> sinof.php
echo "</head>" >> sinof.php
echo "</html>" >> sinof.php
chmod 777 sinof.php

sicnature ---------------------------------------------------------------------
Your current IP address is: 54.198.158.24
Your IP address location: 美国
Your IP address country and region: 美国 美国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 海南仙岛海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source http://www.myzhenai.com.cn/post/1777.html

没有评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注