Get Hardware Info

How To Find Out Hardware Information In A Linux System

--"-- Updated recently --"--

"How To Get/View Hardware Details/Information In Linux"...... How to find all hardware device details in a linux system....???? Here is the solution:
"" script....

***Simple|Interactive|User-friendly|runs on RHEL7.x as well****

This script has been tested to run successfully on Linux variants such as RHEL 7/6/5, SLES 12/11, Mint16, Ubuntu 16/14, BOSS 6(Debian) etc. running on 64/32 bit architectures. It may work on other variants as well, however, not tested. These tests were run on virtual machines.

This is a small, light weight script which makes use of native Linux utilities to get the required details and doesn't need much space.


Name Of The Script:
Build To Run On: RHEL 7/6/5, SLES 11/12, Ubuntu 16/14 etc.,
Who Can Run This Script: Root User or a sudo user.
Dependency: Packages required “dmidecode, smartmontools, sysstat”.
Output: This script when called, it would print details based on arguments passed.


This script would simply print hardware details as mentioned below:

- Operating system (Linux) release version, kernel version, up-time details etc.
- System (server) vendor, serial number etc.
- Server main board details.
- Server BIOS at a glance.
- Server Processor details.
- Server physical memory (RAM) details.
- PCI devices/controllers at a glance.
- Hard disk drive details.
- Network hardware info.
- System Health Status (file system usage, top CPU/RAM consuming process etc.,)

This script is user-friendly and interactive and needs an argument to be passed to the script to get details. When called without arguments it would simply print out a short help message as shown below:-

Get Help:- To get help on how to run this script, call the script with “--help OR --info” as an argument as shown below:-

So, pass the argument as required to the script and which would print details. For example, to print system memory (RAM) details, one could pass “--RAM OR --ram OR --memory” as shown below:-

Likewise, to get details about Operating System such as version, hardware etc, call the script with “--system” as an argument as shown :-

New Change >>> Added capability to list out multipathed drives separate from local drives as shown below:

new feature of mdisk in hwlist script added.PNG

Recent Change >>> Now, network bonding interfaces are listed out separately:

If you wish to dump all the details into a text file for later reference or to send it somewhere else, you could do so now. To get this done, execute the script with “--dump <dumpfilelocation>” as shown below:-
#./ --dump /tmp/hardware.out
The above command would dump all hardware details on to file /tmp/hardware.out which is a simple text file.


Download the script file and change permission to executable if required. Also, make sure indentation is not changed before executing this script.
#chmod u+x
If you are unable to download and move this script file to your Linux system then you may need to copy the complete contents of the file as it is and paste into your file, set execute bit and run it later.

NOTE: If you copy the contents of the script manually then please keep an eye on indentation, sometimes due to incorrect indentation script would fail to run properly.

If you receive errors as shown below:

[root@localhost Desktop]# ./ bash: ./ /bin/bash^M: bad interpreter: No such file or directory
[root@localhost Desktop]# bash : command not found : command not found ' line 37: syntax error near unexpected token ` ' line 37: `head_fun()

Then it is because of file being moved/copied from a non-linux system to linux system, hence, there are extra characters added which bash can't understand hence, run the below command to fix it:

#sed -i -e 's/\r$//'

After running the above the command, script should gets executed:

[root@localhost Desktop]# ./ Usage: ./ {--memory|--cpu|--disk|--network|--details|--system|--health|--dump <PathForDumpFile> } To get help : ./ --help|--info

*You may prefer to scan the download before executing on a system. You may also wish to run this on a non-production server before executing it on a production system.

View the release files:

One could view/browse through the script file here, or can be copied directly from this file:

View sample text output file produced by "" script when "--all" OR "--details" or "--dump" argument used:


Puran singh said...

Good one, thanks for sharing

Sadashiva Murthy said...

Thanks Puran.

J Balajee said...

Sir, can u give the script for shutdown all ubuntu system from server in lab send to this mail id

Sadashiva Murthy said...


Please check my recent post:

Sadashiva Murthy M

karthi said...

Hi Siva bro Nice post especially i liked your script ... Motivating too...visit my blog .... I also try scripting my expectation in hardware related script filed in your blog.. thanks for your explained post

Anonymous said...

good one..

Anonymous said...

Awesome script. Could you update the script to collect temperature and fan speed?

Nazeer Qureshi said...

I am unable to run this script.

: command not found
: command not found
' line 37: syntax error near unexpected token `
' line 37: `head_fun()

Sadashiva Murthy said...

Please check the script file that you are running. Sometimes, when script file gets copied or moved, some extra characters gets added at the end of each line. Check this and make sure no such characters are added up. Also, make sure indentation is not altered when you copy file.

ychaouche said...

Hello and thank you so much for this script, best output I could get from all other scripts I have tried : <- top, strips off uninstalled modules
dmidecode <- best, not too much details
hwinfo <- good, too much detail
inxi <- very readable
lshw <- not very informative

Anonymous said...

Useful script. thank you

Anonymous said...

One of the best sites for Unix. Neat and clear explanation of topics.
Thanks for explaining the script.