当前位置:   article > 正文

linux shell 查看物理cpu个数 核数 逻辑cpu个数_shell怎么查看机器上有多少个cpu

shell怎么查看机器上有多少个cpu

shell命令如下:

  1. # 总核数 = 物理CPU个数 X 每颗物理CPU的核数
  2. # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
  3. # 查看物理CPU个数
  4. cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
  5. # 查看每个物理CPU中core的个数(即核数)
  6. cat /proc/cpuinfo| grep "cpu cores"| uniq
  7. # 查看逻辑CPU的个数
  8. cat /proc/cpuinfo| grep "processor"| wc -l
  9. #查看CPU信息(型号)
  10. cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
  11. #查看内 存信息
  12. cat /proc/meminfo

运行结果如下:

  1. [root@localhost ~]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
  2. 2
  3. [root@localhost ~]# cat /proc/cpuinfo| grep "cpu cores"| uniq
  4. cpu cores : 2
  5. [root@localhost ~]# cat /proc/cpuinfo| grep "processor"| wc -l
  6. 4
  7. [root@localhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
  8. 4 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  9. [root@localhost ~]# cat /proc/meminfo
  10. MemTotal: 7990024 kB
  11. MemFree: 4886992 kB
  12. MemAvailable: 5253736 kB
  13. Buffers: 0 kB
  14. Cached: 588880 kB
  15. SwapCached: 5916 kB
  16. Active: 1297368 kB
  17. Inactive: 1323160 kB
  18. Active(anon): 991488 kB
  19. Inactive(anon): 1071196 kB
  20. Active(file): 305880 kB
  21. Inactive(file): 251964 kB
  22. Unevictable: 0 kB
  23. Mlocked: 0 kB
  24. SwapTotal: 8388604 kB
  25. SwapFree: 8364028 kB
  26. Dirty: 48 kB
  27. Writeback: 0 kB
  28. AnonPages: 2028412 kB
  29. Mapped: 238144 kB
  30. Shmem: 31028 kB
  31. Slab: 206856 kB
  32. SReclaimable: 60640 kB
  33. SUnreclaim: 146216 kB
  34. KernelStack: 26976 kB
  35. PageTables: 47232 kB
  36. NFS_Unstable: 0 kB
  37. Bounce: 0 kB
  38. WritebackTmp: 0 kB
  39. CommitLimit: 12383616 kB
  40. Committed_AS: 18943888 kB
  41. VmallocTotal: 34359738367 kB
  42. VmallocUsed: 227252 kB
  43. VmallocChunk: 34359277564 kB
  44. Percpu: 68608 kB
  45. HardwareCorrupted: 0 kB
  46. AnonHugePages: 1044480 kB
  47. CmaTotal: 0 kB
  48. CmaFree: 0 kB
  49. HugePages_Total: 0
  50. HugePages_Free: 0
  51. HugePages_Rsvd: 0
  52. HugePages_Surp: 0
  53. Hugepagesize: 2048 kB
  54. DirectMap4k: 167744 kB
  55. DirectMap2M: 6123520 kB
  56. DirectMap1G: 4194304 kB

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/154195
推荐阅读
相关标签
  

闽ICP备14008679号