Introduction
This article is showing how to get an information about the processor model of a machine. There are several ways of retrieving the information itself. I. t is because there are lots of command, tools or utility available in the operating system for getting that kind of information. In this context, the command, tools or utility is the one available in the Linux operating system family. Below, all of the discussion will further describe several of those command, tool or utility. Off course, it is for printing only the information about the processor model in a machine.
lshw
This is a specific command available in Linux operating system family. According to the manual page, lshw is a command for listing hardward available in the machine. The following command is the command for listing hardware to print only the model of the processor available in the machine :
user@hostname:~$ lshw -class processor | grep product WARNING: you should run this program as super-user. product: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz WARNING: output may be incomplete or inaccurate, you should run this program as super-user. user@hostname:~$
The information about the processor model exist as in the output of the above command execution. There is an additional filter to select or print only the output where the line of that output containing only ‘product’ string. So, the output of the command only print the product or the model of the processor.
cat /proc/cpuinfo
This is basically printing the content of the information available in the file with the name of ‘cpuinfo’. The file exist in /proc directory. The utility for printing the content of the file is cat. By modifying on how to print the file content using a specific filter such as ‘grep’ and ‘uniq’, it will print the suitable information about the processor model :
user@hostname:~$ cat /proc/cpuinfo | grep model\ name | uniq model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz user@hostname:~$
The above command for printing the information about the processor model has several filter. The first one is ‘grep’ where it will filter and print only the output containing ‘model name’. The second filter is ‘uniq’ where that filter itself will only print one output if there are several lines which has the same content.