Views:
1,725β
Votes: 1β
β
Solution
Tags:
bash
java
hardware
cpu
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1190592
Title:
How to get Processor ID from any linux command
ID:
/2019/11/21/How-to-get-Processor-ID-from-any-linux-command
Created:
November 21, 2019
Edited: June 12, 2020
Upload:
December 22, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
From comments:
sudo dmidecode -t processor | grep -E ID | sed 's/.*: //'
The sed
command is used to remove the line prefix: β ID: β as explained in this popular answer:
Explanation:
First part pipes string to
sed
.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
deleting).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.