Back
I have the script, but I do not know how to get this last element in one printout:
cat /proc/cpuinfo | awk '/^processor/{print $3}'
The last element should hold the number of CPUs, minus 1.
Use the below command:
grep -c ^processor /proc/cpuinfo
will count the number of lines starting with
"processor" in /proc/cpuinfo
For systems with hyper-threading, you can use
grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}'
which should return 8
To know about Linux join the Linux training
31k questions
32.8k answers
501 comments
693 users