🔍 See Original Answer on Ask Ubuntu 🔗
How to get Processor ID from any linux command
November 21, 2019
Edited: June 12, 2020
November 24, 2022
Copy to clipboard: false
sudo dmidecode -t processor | grep -E ID | sed 's/.*: //'
sed command is used to remove the line prefix: “ ID: “ as explained in this popular answer:
First part pipes string to
The second is a basic sed substitution. The part between the first and
second / is the regex to search for and the part between the second
and third is what to replace it with (nothing in this case as we are
For the regex, . matches any character, * repeats this any number of
times (including zero) and : matches a colon. So effectively it is
anything followed by a colon. Since .* can include a colon, the match
is ‘greedy’ and everything up to the last colon is included.