Page 1 of 1

The HW info script.

Posted: 13 Oct 2015, 11:19
by viking60
Inxi gives a lot of good HW info, but sometimes we have the need to dig deeper or simply get additional info.

It may be to get an overview of all the partitions/HW that are not mounted etc etc.
So I made me a hardcore info script that provides such info and put it in the startup in my Tmux.
Image

This is the menu:
Image

It comes in handy and as you can see it calls inxi too so it covers the needs.All hardware will generate a html page in ~/AllHW.html that you can open and read with your browser in a user friendly format.
Here is the script:

Code: Select all

#!/bin/bash
#Setting up some colors I might use later here:
red='\e[0;31m'
RED='\e[1;31m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NC='\e[0m' # No Color

VAR=$'1)Memory Information\n2) Bios information\n3) Processor Information\n4) System Information\n5) Partitions\n6) Devices\n7) PCI\n8)All Hardware\n9)Inxi\n10) Quit'
PS3='Please enter your choice: '
options=("Memory" "Bios" "Processor" "System" "Partitions" "Devices" "PCI" "All HW" "Inxi" "Quit")
select opt in "${options[@]}"
do
    case $opt in

    "Memory")
       # if [ "$RESP" = "y" ]; then
        #    echo "you chose choice 1"
       # else
sudo dmidecode -t memory
echo -e   "$cyan $VAR $NC"       

 #   echo "Thank you."
          #  sleep 2
           # exit
       # fi
        ;;
    "Bios")
echo "Bios Information"       
sudo dmidecode -t bios
echo -e "$cyan $VAR $NC"
#cat menufile
   ;;
    "Processor")
sudo dmidecode -t processor
  lscpu
        echo -e "$cyan $VAR $NC"
        ;;
 "System")
sudo dmidecode -t system
        echo -e "$cyan $VAR $NC"
   ;;
 "Partitions")
sudo fdisk -l
        echo -e "$cyan $VAR $NC"
        ;;
       "Devices")
sudo lsblk
        echo -e "$cyan $VAR $NC"
        ;;
 "PCI")
lspci
        echo -e "$cyan $VAR $NC"
        ;;
"All HW")
sudo lshw
sudo lshw -html > ~/AllHW.html
echo -e "$red a report has been created and saved in ~/AllHW.html you can read it with your browser in a user friendly format!"
        echo -e "$cyan $VAR $NC"
        ;;
         "Inxi")
inxi -F
        echo -e "$cyan $VAR $NC"
        ;;
   "Quit")
        break
        ;;
    *)
        echo invalid option
        ;;
    esac
done



Copy it and save it to a file called binfo.sh (for berserk info) or whateveryouwant.sh and chmod it to execute: Using very common names like "info.sh" is not a good idea since they may be "taken".

Code: Select all

chmod -x binfo.sh


After that you can execute it with

Code: Select all

./binfo.sh

If you do not use sudo you will need to run this script as root for most of the functions.

If you want to execute the script without the hassle of ./binfo.sh and simply start it by typing binfo then you can symlink it to you local bin like this

Code: Select all

ln -s /home/myname/skripts/binfo.sh /usr/local/bin/binfo

Restart bash (or zsh)

Code: Select all

source ~/.bashrc

or

Code: Select all

source ~/.zshrc

and the script will start whenever you type binfo in a terminal. No need to navigate to your scripts directory and no need to type extensions. :jackpot
:A
http://showterm.io/7285973e58a8efaa4716a

Re: The HW info script.

Posted: 17 Oct 2015, 09:43
by dedanna1029
Thanks, I need this. Can't find inxi for now for Mageia (mirrors to wade through to get it) so the script will come in handy.

Re: The HW info script.

Posted: 19 Oct 2015, 22:44
by dedanna1029
I'm giving it a shot today. Need some info on my chipset that I'm hoping to get from it.