![1 Star 1 Star](https://i0.wp.com/www.devtech101.com/wp-content/plugins/wp-postratings/images/stars_crystal/rating_on.gif?w=1200&ssl=1)
![2 Stars 2 Stars](https://i0.wp.com/www.devtech101.com/wp-content/plugins/wp-postratings/images/stars_crystal/rating_on.gif?w=1200&ssl=1)
![3 Stars 3 Stars](https://i0.wp.com/www.devtech101.com/wp-content/plugins/wp-postratings/images/stars_crystal/rating_half.gif?w=1200&ssl=1)
![4 Stars 4 Stars](https://i0.wp.com/www.devtech101.com/wp-content/plugins/wp-postratings/images/stars_crystal/rating_off.gif?w=1200&ssl=1)
![5 Stars 5 Stars](https://i0.wp.com/www.devtech101.com/wp-content/plugins/wp-postratings/images/stars_crystal/rating_off.gif?w=1200&ssl=1)
![](https://i0.wp.com/www.devtech101.com/wp-content/plugins/wp-postratings/images/loading.gif?resize=16%2C16&ssl=1)
How to get the CPU/core and thread count in Solaris.
#!/bin/bash nproc=`(/usr/bin/kstat -m cpu_info | grep chip_id | sort -u | wc -l | tr -d ' ')` vproc=`(/usr/bin/kstat -m cpu_info | grep 'module: cpu_info' | sort -u | wc -l | tr -d ' ')` ncore=`(/usr/bin/kstat -m cpu_info | grep core_id | sort -u | wc -l | tr -d ' ')` echo "Total number of physical processors: $nproc" echo "Number of virtual processors: $vproc" echo "Total number of cores: $ncore" echo "Number of cores per physical processor: $(($ncore/$nproc))" echo "Number of hardware threads (strands) per core: $(($vproc/$ncore))"
Output example
./get_cpu_core_count.sh Total number of physical processors: 2 Number of virtual processors: 16 Total number of cores: 12 Number of cores per physical processor: 6 Number of hardware threads (strands) per core: 1
Update: Simpler core count script, to get the script click here
Output example
CPUs Cores Threads Operating System cpuType 4 64 512 SunOS 5.11 sun4v-platform 3600 MHz