How can I find the hardware model in Linux?
using the dmidecode | grep -A3 '^System Information'
command. There you'll find all information from BIOS and hardware. These are examples on three different machines (this is an excerpt of the complete output):
System Information
Manufacturer: Dell Inc.
Product Name: Precision M4700
System Information
Manufacturer: MICRO-STAR INTERANTIONAL CO.,LTD
Product Name: MS-7368
System Information
Manufacturer: HP
Product Name: ProLiant ML330 G6
Try sudo dmidecode -t baseboard
for full information on the DMI table contents relevant to your baseboard, in a human readable form. For just the System Product Name, you can use either (type dmidecode -s
to get a list of strings keywords):
sudo dmidecode -s system-product-name
sudo dmidecode -s baseboard-product-name
Other relevant options for motherboard info are
sudo dmidecode -s system-version
sudo dmidecode -s baseboard-version
sudo dmidecode -s system-manufacturer
sudo dmidecode -s baseboard-manufacturer
Try sudo dmidecode -s
for a full list of system DMI strings available.
For the record, much of this information is available under /sys/devices/virtual/dmi/id on modern Linuces (ie, since at least 2011), and much if it- notably, not including serial numbers- is readable by regular users. To answer the original poster's question, product_name
is the file that contains the system's model name.
bios_date
bios_vendor
bios_version
board_asset_tag
board_name
board_serial
board_vendor
board_version
chassis_asset_tag
chassis_serial
chassis_type
chassis_vendor
chassis_version
modalias
power
product_name
product_serial
product_uuid
product_version
smbios_version
subsystem
sys_vendor
uevent
And here would be a handy-dandy script that any user could run, to display the goodness:
#!/bin/bash
cd /sys/devices/virtual/dmi/id/
for f in *; do
printf "$f "
cat $f 2>/dev/null || echo "***_Unavailable_***"
done
No filenames have spaces in them, so this information is easily manipulated by utilities such as awk, for your own nefarious purposes!