메뉴 건너뛰기

XEDITION

Server

How To View CPU Temperature On Linux

proin 2020.11.10 15:45 조회 수 : 1

https://ostechnix.com/view-cpu-temperature-linux


This brief tutorial describes how to view CPU temperature on Linux using lm_sensors. The Lm_sensors, short for Linux-monitoring sensors,  is a free software that provides the necessary tools and drivers for monitoring CPU temperatures, voltage, humidity, and fans. It can also detect chassis intrusions. So, you can find out a defective hardware components, and replace it to avoid the system hanging or overheating issues.

Install lm_sensors on Linux

Lm_sensors comes pre-installed with most modern Linux operating systems. If it is not installed already, you can install it as shown below.

 

On Arch Linux and its derivatives:

$ sudo pacman -S lm_sensors

On RHEL, CentOS, Fedora:

$ sudo yum install lm_sensors

Or,

$ sudo dnf install lm_sensors

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install lm-sensors

On SUSE, openSUSE:

$ sudo zypper in sensors

Configure Lm_sensors

Once installed, run the following command to configure lm_sensors:

$ sudo sensors-detect

The sensors-detect is a stand-alone program for detecting installed hardware and recommending specific modules to load. The "safe" answers are the defaults, so just hit to ENTER the accept the default values. It won't cause any problems. This will create the /etc/conf.d/lm_sensors configuration file which is used by lm_sensors.service to automatically load kernel modules on boot.

The sample output of the above command in my DELL Laptop:

# sensors-detect version 3.6.0
# System: Dell Inc. Inspiron N5050 [Not Specified] (laptop)
# Board: Dell Inc. 01HXXJ
# Kernel: 5.4.0-42-generic x86_64
# Processor: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz (6/42/7)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): 
Module cpuid loaded successfully.
Silicon Integrated Systems SIS5595... No
VIA VT82C686 Integrated Sensors... No
VIA VT8231 Integrated Sensors... No
AMD K8 thermal sensors... No
AMD Family 10h thermal sensors... No
AMD Family 11h thermal sensors... No
AMD Family 12h and 14h thermal sensors... No
AMD Family 15h thermal sensors... No
AMD Family 16h thermal sensors... No
AMD Family 15h power sensors... No
AMD Family 16h power sensors... No
Intel digital thermal sensor... Success!
 (driver `coretemp')
Intel AMB FB-DIMM thermal sensor... No
Intel 5500/5520/X58 thermal sensor... No
VIA C7 thermal sensor... No
VIA Nano thermal sensor... No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): 
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor/ITE'... No
Trying family `SMSC'... No
Trying family `VIA/Winbond/Nuvoton/Fintek'... No
Trying family `ITE'... No
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor/ITE'... Yes
Found unknown chip with ID 0xfc11

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (YES/no): 
Probing for `National Semiconductor LM78' at 0x290... No
Probing for `National Semiconductor LM79' at 0x290... No
Probing for `Winbond W83781D' at 0x290... No
Probing for `Winbond W83782D' at 0x290... No

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no): 
Using driver `i2c-i801' for device 0000:00:1f.3: Intel Cougar Point (PCH)
Module i2c-dev loaded successfully.

Next adapter: SMBus I801 adapter at f040 (i2c-0)
Do you want to scan it? (YES/no/selectively): 
Client found at address 0x50
Probing for `Analog Devices ADM1033'... No
Probing for `Analog Devices ADM1034'... No
Probing for `SPD EEPROM'... Yes
 (confidence 8, not a hardware monitoring chip)
Probing for `EDID EEPROM'... No

Next adapter: i915 gmbus ssc (i2c-1)
Do you want to scan it? (yes/NO/selectively): 

Next adapter: i915 gmbus vga (i2c-2)
Do you want to scan it? (yes/NO/selectively): 

Next adapter: i915 gmbus panel (i2c-3)
Do you want to scan it? (yes/NO/selectively): 

Next adapter: i915 gmbus dpc (i2c-4)
Do you want to scan it? (yes/NO/selectively): 

Next adapter: i915 gmbus dpb (i2c-5)
Do you want to scan it? (yes/NO/selectively): 

Next adapter: i915 gmbus dpd (i2c-6)
Do you want to scan it? (yes/NO/selectively): 

Next adapter: DPDDC-B (i2c-7)
Do you want to scan it? (yes/NO/selectively): 


Now follows a summary of the probes I have just done.
Just press ENTER to continue: 

Driver `coretemp':
 * Chip `Intel digital thermal sensor' (confidence: 9)

Do you want to overwrite /etc/conf.d/lm_sensors? (YES/no): 
Unloading i2c-dev... OK
Unloading cpuid... OK

Done! Let us go ahead and see how to use find the CPU temperature.

View CPU Temperature On Linux Using Lm_sensors

Type the following command to view the CPU temperature information of your Linux box:

$ sensors

Sample output:

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +57.0°C  (high = +80.0°C, crit = +85.0°C)
Core 0:        +57.0°C  (high = +80.0°C, crit = +85.0°C)
Core 1:        +54.0°C  (high = +80.0°C, crit = +85.0°C)

BAT0-acpi-0
Adapter: ACPI interface
in0:          12.43 V  
curr1:       1000.00 uA 

dell_smm-virtual-0
Adapter: Virtual device
Processor Fan: 3449 RPM
CPU:            +57.0°C  
Other:          +52.0°C  
Other:          +51.0°C  
GPU:            +16.0°C  
Other:          +55.0°C  

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +57.5°C  (crit = +84.0°C)
View CPU Temperature On Linux Using Lm_sensors

View CPU Temperature On Linux Using Lm_sensors

As you see in the above output, lm_sensors displays my CPU's current temperature, high and critical temperature in the brackets. If you find out any of your hardware devices reaches high or critical temperature, you probably need to check that hardware device.

By default, Lm_sensors displays the temperature in Celsius.

To display the temperatures in Fahrenheit instead of Celsius, use -f option.

$ sensors -f

Sample output:

coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +131.0°F  (high = +176.0°F, crit = +185.0°F)
Core 0:       +131.0°F  (high = +176.0°F, crit = +185.0°F)
Core 1:       +123.8°F  (high = +176.0°F, crit = +185.0°F)

BAT0-acpi-0
Adapter: ACPI interface
in0:          12.43 V  
curr1:       1000.00 uA 

dell_smm-virtual-0
Adapter: Virtual device
Processor Fan: 3510 RPM
CPU:           +127.4°F  
Other:         +120.2°F  
Other:         +120.2°F  
GPU:            +60.8°F  
Other:         +123.8°F  

acpitz-acpi-0
Adapter: ACPI interface
temp1:       +128.3°F  (crit = +183.2°F)

To monitor the CPU temperature in real time, you can use 'watch' command like below.

$ watch sensors

Sample output:

Monitor CPU temperature in real time with lm_sensors in Linux

Monitor CPU temperature in real time with lm_sensors in Linux

The result will update every 2 seconds. Press CTRL+C to stop the monitoring at any time.

For more details, refer the man pages.

$ man sensors

Resource:

 

Thanks for stopping by!

 

 

 


 

 

 

 

번호 제목 글쓴이 날짜 조회 수
30 Proxy로 Gitlab Container의 웹IDE에서 브런치를 못 불러오는 문제 해결 방법 proin 2022.04.28 2
29 Docker를 사용하여 사용자를 위해 웹 사이트를 분리 할 수 ​​있습니까? 수있는 자체 웹 사이트가있는 서버 (예 : proin 2022.02.24 1
28 docker 가 우분투 ufw 같이 사용시 방화벽룰 무시하는 문제 해결하기 proin 2021.08.19 1
27 Ubuntu KERNEL Upgrade, Downgrade, Remove , Hold 18.04 proin 2021.06.07 2
26 GNU Tar를 이용한 증분 백업과 복원의 개념 이해 proin 2021.05.13 3
25 [UNIX / Linux] 특수 권한(setuid, setgid, sticky bit) file proin 2021.04.27 1
24 Apache2 웹서버에 https 적용하기 (Let's Encrypt SSL Certificate) file proin 2021.04.19 9
23 [LINUX] 기본 명령어로 메인보드, 씨피유, 메모리, 디스크, 네트워크 모델명 및 정보 확인하기 proin 2021.04.16 1
22 [Ubuntu] 우분투 방화벽(UFW) 설정 proin 2021.03.25 3
21 실행중인 컨테이너의 hostname 변경..? proin 2021.02.25 3
20 ubuntu APM 자동 설치하기(php 5.6, php 7.0) proin 2021.01.14 9
» How To View CPU Temperature On Linux proin 2020.11.10 1
18 CPU/MEM STRESS TEST IN UBUNTU 18.04 proin 2020.11.10 2
17 UBUNTU에서 GPU 모니터링 더 멋지게 하기 proin 2020.11.10 5
16 UBUNTU에서 GPU 모니터링 하는 4가지 방법 proin 2020.11.10 3
15 리눅스 stress 툴을 통해 CPU, Memory 스트레스 부하 주는 방법 proin 2020.11.10 1
14 메모리,하드,cpu 스트레스 테스트 proin 2020.11.10 2
13 Ubuntu SVN 추천 :: RabbitVCS 설치하기 proin 2020.09.11 1
12 [기본.1] Linux 서버에 SVN 구축(설치)하기 proin 2020.09.11 2
11 sudo 설정하기 proin 2020.09.09 1
위로