State.sh
From Federal Burro of Information
state.sh
#!/bin/sh -x now=`date "+%Y%m%d%H%M%S"` savepath=/root/system_state/${now} mkdir -p ${savepath} /sbin/lsmod | sort > ${savepath}/lsmod cat /proc/cpuinfo > ${savepath}/cpuinfo dmesg > ${savepath}/dmesg crontab -u root -l > ${savepath}/crontab.root cp /etc/crontab ${savepath}/crontab.etc cp /etc/sudoers ${savepath}/sudoers /sbin/ifconfig -a > ${savepath}/ifconfig df -h | sort > ${savepath}/df-h cat /etc/mtab > ${savepath}/mtab /bin/netstat -avpn 2>/dev/null > ${savepath}/netstat-avpn /bin/netstat -rn > ${savepath}/netstat-rn /sbin/lsmod | sort > ${savepath}/lsmod.sorted if [ -e /bin/systemctl ] then /bin/systemctl -a -l --no-legend --no-pager | sort > ${savepath}/systemd.all.long else /sbin/chkconfig --list > ${savepath}/chkconfig-list /sbin/service --status-all > ${savepath}/service-status fi /sbin/iptables-save > ${savepath}/iptables-save uname -a > ${savepath}/uname-a rpm -q -a --qf "%{INSTALLTIME}\t%{INSTALLTIME:date}\t%-30{NAME}\t%-10{VERSION}\t%{RELEASE}\t%{ARCH}\n" | sort -rn > ${savepath}/rpm.qa.sorted
With this script you can easily collect state and later you can "diff -r datex datey"
you might alos like this alias for diffing directories:
alias diffss='diff --width=180 --suppress-common-lines --side-by-side'
also I like to add --exclude=dmesg
diff --width=180 --suppress-common-lines --side-by-side --exclude dmesg