How can I find the hardware model in Linux?
Solution 1
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
Solution 2
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.
Solution 3
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!
Solution 4
On modern Linux systems, you can easily do things like this as any user:
cat /sys/devices/virtual/dmi/id/sys_vendor
cat /sys/devices/virtual/dmi/id/product_name
This also works well for CoreOS, which does not ship with dmidecode
.
Note: This has been mentioned in other answers/comments, but is hopefully more visible here, as this is a much easier method than using dmidecode
.
Solution 5
Everyone here talks about the great dmidecode
command and the -t
parameter, but with sudo lshw -short
you also get easily the product name and model:
$ sudo lshw -short
H/W path Device Class Description
====================================================
system UX303UB (ASUS-NotebookSKU)
/0 bus UX303UB
Other great commands for getting hardware info:
-
inxi
[-F] All-in-one and friendly, written in Perl. Tryinxi -SMG -! 31 -y 80
-
lscpu
# Better than /proc/cpuinfo -
lsusb
[-v] -
lsblk
[-a] # Better than df -h. Block Device Information. sudo hdparm /dev/sda1
Related videos on Youtube
![Eduard Florinescu](https://i.stack.imgur.com/vUFRO.png?s=256&g=1)
Eduard Florinescu
Updated on September 18, 2022Comments
-
Eduard Florinescu over 1 year
I used a system information utility to take the model number of a system, and also of the motherboard.
DMI System Manufacturer LENOVO DMI System Product 2306CTO DMI System Version ThinkPad X230 DMI Motherboard Product 2306CTO
Is there a way to get model number, in this case
2306CTO
, in Linux?-
Sergey about 11 years
-
Bratchley about 11 yearsFor clarity it seems you're interested in hardware product, not specifically the motherboard. For example, "ThinkPad X230" is a type of computer not motherboard.
-
Blake Russo over 5 yearsYou can also get some info without extra packages by running dmesg command or checking /var/log/dmesg* .
-
Time4Tea about 4 yearsIt would be nice to know what 'System Information Utility' you used.
-
-
eppesuig about 11 years@JoelDavis, I was not aware of those options before. I will use them. Thanks.
-
Eduard Florinescu over 9 yearsGreat, that's great with linux-based most of the if you don't find a tool the stuff you need (OS, hardware info) is somewhere in
/sys
or/proc
. Thanks -
qwertzguy over 9 yearsNote: needs root. If you want all the info you have permissions for under the current user, use:
cat /sys/devices/virtual/dmi/id/*
(and it does allow you to get the model name and the sort using a normal user) -
qwertzguy over 9 yearsAwesome! A solution that works for non-root!
-
Mike S about 8 yearsNote that this dmi information may only be applicable to Intel-based PCs. I have a network device that is driven by a Linux-based ARM computer, and neither dmicode or the path in /sys is available to it.
-
cjac over 7 yearsPiping the output of dmidecode without arguments to grep is interesting, but not the most efficient means of getting the information. dmidecode can print exactly what the OP is asking for by specifying the 'system-product-name' keyword string: sudo dmidecode -s system-product-name
-
Shadur over 7 yearsAside from lshw, none of those commands answer the question the OP asks. They're highly useful utilities, yes, but not exactly in the scope of the question...
-
Pablo A over 7 years@shadur why you downvote me? I answer the question in a way any other answer do, and then just offer extra useful information, what is pretty command on any great post.
-
Joshua Detwiler almost 6 years
grep
needs quotes. -
Joshua Detwiler almost 6 yearsI think it's worth noting that older systems don't have flags available on
dmidecode
, nor even a man page. The answer above is the most Linux-portable answer here, I think. The-t
and-s
flags are useful on newer systems for sure. -
Mike S almost 6 yearsLooks nice. I'm wondering if there's a way that this tool will return system or board serial numbers? Then you don't need root for just about any system introspection like this. (I'm guessing the answer is "no").
-
Lizardx almost 6 yearsPrior to a change in the linux kernel, which creates the /sys file system, you could get the serial numbers for these things without being root, but after the change, which is totally outside of inxi's control, you need to be root, and there is no way to work around that. Obviously that was a silly decision and a regression based on some bad idea someone had, but there's nothing inxi can do to resolve that problem. sudo inxi -Mxxx returns serials always. On some systems no sudo is required, depends on the kernel version I think.