The HW info script.

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

The HW info script.

Postby viking60 » 13 Oct 2015, 11:19

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
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: The HW info script.

Postby dedanna1029 » 17 Oct 2015, 09:43

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.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: The HW info script.

Postby dedanna1029 » 19 Oct 2015, 22:44

I'm giving it a shot today. Need some info on my chipset that I'm hoping to get from it.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html


Return to “Tips & Tricks”