Linux system information gathering

From PedrosBrainDump

Save your linux configurations before making a change is important for at least 2 reasons:

  • If something goes wrong you can restore with the data collected
  • If something goes wrong but not related to what you did, you'll need prof of this (trust me this happens)

My script:

echo 'cat /etc/*release' 
cat /etc/*release 
echo 
echo 
echo 'df -h' 
df -h 
echo 
echo 
echo 'ip a' 
ip a 
echo 
echo 
echo 'ps -ef' 
ps -ef 
echo 
echo 
echo 'netstat -nr' 
netstat -nr 
echo 
echo 
echo 'rpm -qa' 
rpm -qa 
echo 
echo 
echo 'uptime' 
uptime 
echo 
echo 
echo 'uname -a' 
uname -a 
echo 
echo 
echo 'uname -r' 
uname -r 
echo 
echo 
echo 'sudo yum history' 
sudo yum history 
echo 
echo 'uptime' 
uptime 
echo 
echo 'sudo yum update --assumeno' 
sudo yum update --assumeno 
echo done


Usually I prefer in one line, easyer and i can just send to the server and save the output easyer

echo 'cat /etc/*release' ; cat /etc/*release ; echo ; echo ; echo 'df -h' ; df -h ; echo ; echo ; echo 'ip a' ; ip a ; echo ; echo ; echo 'ps -ef' ; ps -ef ; echo ; echo ; echo 'netstat -nr' ; netstat -nr ; echo ; echo ; echo 'rpm -qa' ; rpm -qa ; echo ; echo ; echo 'uptime' ; uptime ; echo ; echo ; echo 'uname -a' ; uname -a ; echo ; echo ; echo 'uname -r' ; uname -r ; echo ; echo ; echo 'sudo yum history' ; sudo yum history ; echo ; echo 'uptime' ; uptime ; echo ; echo 'sudo yum update --assumeno' ; sudo yum update --assumeno ; echo done