How to find out your laptop's name with bash
- Login o registrati per inviare commenti
Hi. If I want to find a 100% sure way to find out the model name of my laptop, is the *dmidecode* command the right way to go? I'm doing this for h-node, in case you were wondering.
I tried the following command and it gave me the right result.
sudo dmidecode | grep "System Information" -A 2
My laptop is Vostro 3300 from Dell. Here's the output I got.
System Information
Manufacturer: Dell Inc.
Product Name: Vostro 3300
So, is this the absolute way to be sure?
Worked for me.
However looks like the manual page for dmidecode says the information is "possibly unreliable". And even "more often than not, information contained in the DMI tables is inaccurate, incomplete or simply wrong."
So it might not be the philosopher's stone.
Quote:
---
So it might not be the philosopher's stone.
---
End quote
Indeed. I got some questionable results already. I have tried this with a few laptops and got correct results about 50-70% of the time.
Try:
sudo lshw
I tried this:
sudo lshw | grep Vostro
Didn't work. My laptop is Vostro 3300.
> Hi. If I want to find a 100% sure way to find out the model name of my
> laptop, is the *dmidecode* command the right way to go? I'm doing this
> for h-node, in case you were wondering.
The 100% sure way is to look on the outside, all laptops have their
model name written somewhere. My YeeLoong doesn't have DMI.
> I tried the following command and it gave me the right result.
>
> sudo dmidecode | grep "System Information" -A 2
Are you sure this always takes first two lines?
You can instead read various files from /sys/class/dmi, these don't need
root access to read.
> So, is this the absolute way to be sure?
If you can find a good unique identifier for the laptop model and have
some data to share, I could implement it in h-client. (There was some
private discussion on this, I don't have access to it.)
I'm not sure if the info I want will always be on the first two lines, but it has worked so far. I didn't compare the output to actual *dmidecode* output, though.
Checked the /sys/class/dmi and found this:
/sys/class/dmi/id/product_name
Got correct result (Vostro 3300) with
cat /sys/class/dmi/id/product_name
Will this command work with any laptop? Is it always reliable?
The commands worked on my netbook (Asus 1001PX) :)
sudo dmidecode | grep "System Information" -A 2
System Information
Manufacturer: ASUSTeK Computer INC.
Product Name: 1001PX
cat /sys/class/dmi/id/product_name
1001PX
Does anyone have any ideas?
It's hilarious but apparently there is no way to do this. I'd say go with
cat /sys/class/dmi/id/{sys_vendor,product_name}
which is equal to the original command AFAIK sans sudo. And then throw in a disclaimer it might be bogus.
- Login o registrati per inviare commenti