BASH Script : All My Info

This script gathers and records everything that I could think of that might be needed to fix errors on my laptop, it’s been very useful, so I decided to share it. If you can think of anything that could be added let me know in the comments. – wolfe

 

#!/bin/bash

COUNTER=0 ;

let COUNTER=COUNTER+1 ;

# for down to the second ... datestamp=`date +%Y-%m-%d--%H-%M-%S` ;
datestamp=`date +%Y-%m-%d-%H-%M-%S` ;
mkdir $HOME"/myinfo/" ;
log=$HOME"/myinfo/myinfo-"$datestamp".txt" ;

echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;

echo "Recording output to "$log ;

echo "" > $log ;

echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;
echo "###########################" >> $log ;
echo "#### BASIC INFORMATION ####" >> $log ;
echo "###########################" >> $log ;
echo "" >> $log ;

echo "Data Gathered On: " `date --rfc-3339=seconds` >> $log ;
wanip=`dig +short myip.opendns.com @resolver1.opendns.com` ;
echo "IP address : " $wanip >> $log ;
MAC=`cat /sys/class/net/eth0/address`;
echo "MAC Address: ". $MAC >> $log ;
HOSTNAME=`cat /etc/hostname` ;
echo "Hostname: "$HOSTNAME >> $log ;
echo "" >> $log ;
echo "Kernal Version: " `uname -r` >> $log ;
echo "--- " `lsb_release -r` >> $log ;

echo "


" >> $log ;


echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;
echo "###############################" >> $log ;
echo "#### HARD-DRIVE FREE SPACE ####" >> $log ;
echo "###############################" >> $log ;
echo "" >> $log ;

hardfree=`df -k` ;
echo "
$hardfree" >> $log ;

echo "


" >> $log ;

echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;
echo "##############################" >> $log ;
echo "#### HARDWARE INFORMATION ####" >> $log ;
echo "##############################" >> $log ;
echo "" >> $log ;

hardware=`lspci -nn` ;
echo "$hardware" >> $log ;

echo "


" >> $log ;


echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;
echo "###############################" >> $log ;
echo "#### Copy of Sources.list  ####" >> $log ;
echo "###############################" >> $log ;
sourcelist=`cat /etc/apt/sources.list` ;

echo "
$sourcelist" >> $log ;


echo "


" >> $log ;

echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;
echo "#############################" >> $log ;
echo "#### Programs installed  ####" >> $log ;
echo "#############################" >> $log ;
# EVERYTHING .... programlist=`apt list --installed` ;
# EVRYTHING w/ description programlist=`aptitude search '~i!~M'` ;-F '%p'
# JUST THE FACT MAN ... programlist=`aptitude search '~i!~M' -F '%p''` ; 
programlist=`dpkg --get-selections | grep deinstall | sed 's/deinstall//g'` ; 
echo "
$programlist" >> $log ;

echo "


" >> $log ;

echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;
echo "##########################" >> $log ;
echo "#### DISC PARTITIONS  ####" >> $log ;
echo "##########################" >> $log ;
hdrive=`cat /proc/partitions` ;
echo "
  $hdrive" >> $log ;
  
echo "


" >> $log ;

echo "INFO STEP $COUNTER DONE" ; let COUNTER=COUNTER+1 ;



Share

Comments are closed