Linux CPU 사양 확인 커맨드 사용 방법

리눅스 서버에서 사용중인 사양을 확인하는 방법을 알아보겠습니다.

사용중인 사양을 확인하기 위해서는 리눅스의 커맨드를 사용해 확인할 수 있습니다.

윈도우처럼 화면에서 확인 할수 있지만 리눅스에서는 주로 커맨드를 사용해야 확인이 가능합니다.

사용할 수 있는 커맨드는 CPU, 메모리, 디스크 용량, 리눅스 버전등을 확인할 수 있습니다.

이번 포스팅에서는 CPU 사양을 확인할 수 있는 커맨드를 알아보겠습니다.

 

CPU 확인

CPU 사양을 확인할 수 있는 커맨드입니다.

cat /proc/cpuinfo

 

리눅스 커맨드 창에 커맨드를 실행하면 현재 사용중이 CPU의 모든 정보가 표시됩니다.

CPU 모델명, 클럭, 코어 수등 모든 정보를 확인할 수 있습니다.

[root@localhost ~]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 85
model name      : Intel(R) Xeon(R) Silver 4214R CPU @ 2.40GHz
stepping        : 7
microcode       : 0x5003102
cpu MHz         : 2394.375
cache size      : 16896 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xsaves arat pku ospke md_clear flush_l1d arch_capabilities
bugs            : spectre_v1 spectre_v2 spec_store_bypass swapgs taa itlb_multihit
bogomips        : 4788.75
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 85
model name      : Intel(R) Xeon(R) Silver 4214R CPU @ 2.40GHz
stepping        : 7
microcode       : 0x5003102
cpu MHz         : 2394.375
cache size      : 16896 KB
physical id     : 2
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xsaves arat pku ospke md_clear flush_l1d arch_capabilities
bugs            : spectre_v1 spectre_v2 spec_store_bypass swapgs taa itlb_multihit
bogomips        : 4788.75
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management:

 

CPU 전체 코어 개수

CPU의 전체 코어 개수는 processor를 통해 알수 있습니다.

전체 정보에서는 processor : 0 과 processor : 1이 출력되었습니다.

즉, CPU 전체 코어 개수는 2개가 됩니다.

CPU 전체 코어 개수만 취득하고 싶은 경우에는 아래 커맨드를 사용합니다.

cat /proc/cpuinfo | grep "^processor"  | wc -l

.

CPU 물리 개수

CPU 물리 개수는 physical id로 확인 할수 있습니다.

동일한 physical id일 경우에는 물리적으로 CPU가 같다고 생각하면 됩니다.

physical id가 다른 경우에는 물리적으로 CPU가 다르다고 보면 됩니다.

CPU 물리 개수만을 취득하는 커맨드입니다.

cat /proc/cpuinfo | grep "physical id" | uniq | wc -l

 

CPU당 코어 개수

CPU마다 물리 코어 갯수를 확인하기 위해서는 cpu cores를 확인하면 됩니다.

cpu cores 정보만 취득하는 커맨드입니다.

cat /proc/cpuinfo | grep "cpu cores" | uniq

 

CPU 모델명 취득

사용중인 CPU 모델명은 model name 항목을 확인합니다.

CPU 모델명만 취득하는 커맨드 입니다.

cat /proc/cpuinfo | grep "model name"

 

물리 코어 개수와 전체 코어 개수 차이

CPU 전체 코어 개수 CPU 물리 개수 x CPU당 코어 개수가 일치하지 않는 경우가 있습니다.

위에서 확인한 경우에는 전체 코어 개수(processor)는 2개입니다.

CPU 물리 개수는 2개, CPU당 코어 개수는 1개 이기 때문에 2 x 1 을 하면 2개로 전체 코어 개수와 동일합니다.

하지만 전체 물리 코어 개수가 2배 이상 차이 나는 경우가 있습니다.

이유는 하이퍼스레딩 때문에 발생합니다.

하이퍼스레딩이란 각 코어에서 둘 이상의 스레드를 실행할 수 있는 기술입니다.

사용중인 CPU가 하이퍼스레딩을 지원하는지 확인을 해서 계산을 해야합니다.

CPU 물리 개수 x CPU당 코어 개수 x 하이퍼스레딩이 전체 코어 개수가 됩니다.

 

댓글