Saturday, August 16, 2014

Linux puter info.

What's on your Linux computer.

Just a simple batch file to collect information about your computer.  A bit dated and there are probably some commands that should have been included, but a good list of commands you can use to find out about your linux box. You will need to remove the "#" in front of some of the commands for them to work. You have to install some of the commands for them to work. You do not have to use all the commands like I did, but it will be interesting to see what is in the file generated. Great for documentation about the system. Good list to have for insurance purposes.



usage: sudo ./hwinfo2file.sh filename

$ sudo ./hwinfo2file.sh My_desktop_computer_info


hwinfo2file.sh
[code]
echo "=================================" >> $file
cat /etc/hostname >> $file
cat /etc/hostname
echo "getting stats"
file=$1.txt
# file="system.txt"
echo " " > $file
echo "=====================================" >> $file
echo  get computername >> $file
cat /etc/hostname >> $file
echo "=====================================" >> $file
echo  get current ip connections >> $file
sudo ifconfig >> $file
echo "-------------------------------------" >> $file
echo  get linux version >> $file
lsb_release -a >> $file
echo "-------------------------------------" >> $file
echo  get memory specs >> $file
free >> $file
echo "-------------------------------------" >> $file
echo  get file storage statistics >> $file
df -h >> $file
echo "-------------------------------------" >> $file
echo  get mounted file system list >> $file
cat /etc/fstab >> $file
echo "-------------------------------------" >> $file
echo  get pci specs >> $file
sudo lspci >> $file
echo "-------------------------------------" >> $file
echo  get loaded modules >> $file
sudo lsmod >> $file
echo "-------------------------------------" >> $file
echo  get current usb attachments. >> $file
sudo lsusb >> $file
echo "-------------------------------------" >> $file
echo get repos >> $file
cat /etc/apt/sources.list >> $file
# echo "-------------------------------------" >> $file
# echo  get installed software >> $file
# sudo dpkg --get-selections >> $file
# echo "-------------------------------------" >> $file
# echo  get hardware info >> $file
# sudo lshw >> $file
# echo "-------------------------------------" >> $file
# echo  get scsi devices >> $file
# sudo lsscsi >> $file
echo "-------------------------------------" >> $file
echo  display /etc/issue >> $file
cat /etc/issue >> $file
# echo "-------------------------------------" >> $file
# echo  get boot up info >> $file
# dmesg >> $file
echo "-------------------------------------" >> $file
echo  get users >> $file
cat /etc/passwd >> $file
echo "-------------------------------------" >> $file
echo  get current users on system >> $file
who >> $file
# echo "-------------------------------------" >> $file
# echo  get system messages >> $file
# cat /var/log/messages >> $file
# echo "-------------------------------------" >> $file
# echo  get rootkit checker log >> $file
# cat /var/log/rkhunter.log >> $file
# echo "-------------------------------------" >> $file
# echo  get syslog >> $file
# cat /var/log/syslog >> $file
echo "-------------------------------------" >> $file
echo  get scheduled events >> $file
cat /etc/anacrontab >> $file
cat /etc/crontab >> $file

[/code]

------------------------
Just was told about this neat little program that will let you know about some of your system variables.

GLADE_PIXMAP_PATH=:
TERM=xterm
SHELL=/bin/bash
XDG_MENU_PREFIX=xfce-
WINDOWID=00000000
GTK_MODULES=canberra-gtk-module
USER=eddie
....
....
....

extern.c  (gcc extern.c -o extern

[code]
 #include <stdio.h>

extern char **environ;

int main(int argc, const char *argv[])
{
        char **i;
        for(i = environ; *i; i++)
                puts(*i);

        return 0;
}
[/code]

No comments:

Post a Comment