For Windows: If you are using Windows, you can check serial number and all other hardware related information in system property using User Interface. You can also get system info using system information command in windows.
For Linux: If you are using any of the Linux systems, you have to run the command to the system details like serial number, manufacturing model… You can do this easily by the dmidecode command in the command line terminal.
It is a command to read DMI table. The name itself depicts as it is a command to decode the value in DMI table.
What is DMI Table in Linux?
DMI table is also called as SMBIO. This table consists of all the hardware, processor, system, BIOS information, etc.
Role of dmidecode Command:
A dmidecode command just fetches the content from this table and display it in the human-readable format on the terminal.
dmidecode
Run this command.
If it is not working, it requires root permission. Try getting admin privilege by running following sudo command.
sudo dmidecode
It will give a long list of information. To shorten it or to get the particular information you have to be specific.
Run the following command.
sudo dmidecode -t system
This command will give complete information about the system.
If you want to get a serial number of the system in any Linux system like Ubuntu, run following command in terminal.
sudo dmidecode -s system-serial-number
This will highlight the serial number of the hardware.
You can also use the dmidecode to read any specific hardware/system parameter by specifying the parameter name.
Note: Kindly make a note. While running any of the dmidecode commands, try all these commands running without sudo first. If you get any error or system ask you for any privilege, use the commands with sudo.
I have tested and verified all these commands on Ubuntu Linux machine. If you are using any other Linux OS system, kindly check, How to get serial number in Linux using the same commands. Do share your result. It will be helpful for other candidates.
I got the solution to what I was looking for.
I have one question for you Aniruddha. How do you remember all these Linux commands going forward? I have to Google search every time as I don’t remember these commands.
Remembering Linux or any commands is part of practicing and using them. More you use them, you will remember these commands. It’s okay if you don’t remember certain commands. You should always know what you need to do and what you can do with commands. You can always search for syntax whenever required or you can take command-line help.
Try open a new LibreOffice document file, copy & paste the command line you’ve tested after you’ve found it on this website, and save that document file as “My own command line tutorial 2022”. If you have forgotten the command line, open again that document file.
How can we get this serial number using python? And is it always unique for every different machine?
In Python, you can execute the shell commands using popen module in Python. The popen is an interface by which you can run executable command to get the output. They are not different always for machines. If you want to uniquely identify each machine, use the MAC address.
How can we get it without sudo?
You have to login as root to run this command without root.
I’m not having success with these methods. They appear to work but the numbers that should be the model or serial number of the PC are all “0”. This PC is an older laptop, its the Toshiba Portege M400, I believe it is one of the variants but I can’t figure that out as I am not getting the information I need. Any assistance with this issue would be most appreciated.
Not sure if this issue is specific to the Toshiba laptop. Sorry!