使用conky监控硬件

conky Github

安装

sudo apt update && sudo apt install conky-all conky-all

包含了所有编译好的扩展模块(比如对更高阶图像、Cairo 绘图、网络协议以及我们前面一直在调用的 hwmon 硬件监控的完整支持)

运行

conky -c 配置文件路径

配置

默认的配置文件位置是 ~/.config/conky/conky.conf 或 sysconfdir/conky/conky.conf。在大多数系统中,sysconfdir 是 /etc,您可以在 /etc/conky/conky.conf 中找到示例配置文件。

命令conky -C将输出一个基本配置

Vars

Config

配置示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
conky.config = {
alignment = 'top_right',
background = true,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'white',
double_buffer = true,
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
extra_newline = false,
font = 'WenQuanYi Micro Hei Mono:size=13',
gap_x = 5,
gap_y = 5,
minimum_height = 5,
minimum_width = 5,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_ncurses = false,
out_to_stderr = false,
out_to_x = true,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
show_graph_range = true,
show_graph_scale = true,
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
use_spacer = 'none',
use_xft = true,
own_window_transparent = true,
}

conky.text = [[
${color grey}信息:$color Conky版本:$conky_version 系统名称:$sysname 主机名:$nodename 内核版本:$kernel 机器:$machine
${color grey}运行时间:$color ${uptime}
$hr
${color #ffcc00}CPU 核心频率 (GHz):$color
核心1: ${freq_g 1} GHz${goto 140}核心2: ${freq_g 2} GHz${goto 280}核心3: ${freq_g 3} GHz
核心4: ${freq_g 4} GHz${goto 140}核心5: ${freq_g 5} GHz${goto 280}核心6: ${freq_g 6} GHz
${color #ffcc00}CPU 核心负载:$color
核心1:${cpu cpu1}% ${goto 100}${cpubar cpu1 10,45} ${goto 160}核心2:${cpu cpu2}% ${goto 260}${cpubar cpu2 10,45} ${goto 320}核心3:${cpu cpu3}% ${goto 420}${cpubar cpu3 10,45}
核心4:${cpu cpu4}% ${goto 100}${cpubar cpu4 10,45} ${goto 160}核心5:${cpu cpu5}% ${goto 260}${cpubar cpu5 10,45} ${goto 320}核心6:${cpu cpu6}% ${goto 420}${cpubar cpu6 10,45}
$hr
${color #ffcc00}主板状态:$color 芯片组温度: ${hwmon acpitz temp 1}°C
${color #ffcc00}CPU 总览:$color 顶盖温度: ${hwmon coretemp temp 1}°C
${color #ffcc00}核心 0 :$color ${hwmon coretemp temp 2}°C ${goto 145}${color grey}核心 1 :$color ${hwmon coretemp temp 3}°C
${color #ffcc00}核心 2 :$color ${hwmon coretemp temp 4}°C ${goto 145}${color grey}核心 3 :$color ${hwmon coretemp temp 5}°C
${color #ffcc00}核心 4 :$color ${hwmon coretemp temp 6}°C ${goto 145}${color grey}核心 5 :$color ${hwmon coretemp temp 7}°C
$hr
${color #ffcc00}内存总览:$color ${memperc}% ${goto 115}${color grey}总量:$color ${memmax}
${memwithbuffersbar 12,100} ${goto 115}${color grey}实际占用:$color ${memwithbuffers}
${color grey}净占用:$color ${mem} ${goto 160}${color grey}空闲:$color ${memfree} ${goto 350}${color grey}可用:$color ${memeasyfree}
${color #ffcc00}交换空间:$color ${swapperc}% ${goto 150}${cpubar 10,35} ${goto 220}${color grey}已用:$color ${swap} / ${swapmax}
$hr
${color grey}上传速度:$color ${upspeed enp1s0}
${color grey}上传速度:$color ${upspeedf enp1s0} KiB/s
${upspeedgraph enp1s0 35,300 00FF00 FF0000 -t -l}
$hr
${color grey}下载速度:$color ${downspeed enp1s0}
${color grey}下载速度:$color ${downspeedf enp1s0} KiB/s
${downspeedgraph enp1s0 35,300 00FF00 FF0000 -t -l}
$hr
${color #ffcc00}任务进程:$color 总计 ${processes} ${goto 200}${color grey}活跃中:$color ${running_processes}
$hr
${color #ffcc00}排行榜进程${goto 200}PID${goto 300}CPU 使用率$color
${top name 1}${goto 200}${top pid 1}${goto 300}${top cpu 1}%
${top name 2}${goto 200}${top pid 2}${goto 300}${top cpu 2}%
${top name 3}${goto 200}${top pid 3}${goto 300}${top cpu 3}%
$hr
${color #ffcc00}排行榜进程${goto 200}PID${goto 300}内存使用率$color
${top_mem name 1}${goto 200}${top_mem pid 1}${goto 300}${top_mem mem 1}%
${top_mem name 2}${goto 200}${top_mem pid 2}${goto 300}${top_mem mem 2}%
${top_mem name 3}${goto 200}${top_mem pid 3}${goto 300}${top_mem mem 3}%
$hr
${color #ffcc00}排行榜进程(perc)${goto 200}PID${goto 300}I/O 占比$color
${top_io name 1}${goto 200}${top_io pid 1}${goto 300}${top_io io_perc 1}%
${top_io name 2}${goto 200}${top_io pid 2}${goto 300}${top_io io_perc 2}%
#hr
${color #ffcc00}排行榜进程(read)${goto 200}PID${goto 300}读取速度$color
${top_io name 1}${goto 200}${top_io pid 1}${goto 300}${top_io io_read 1}
${top_io name 2}${goto 200}${top_io pid 2}${goto 300}${top_io io_read 2}
#hr
${color #ffcc00}排行榜进程(write)${goto 200}PID${goto 300}写入速度$color
${top_io name 1}${goto 200}${top_io pid 1}${goto 300}${top_io io_write 1}
${top_io name 2}${goto 200}${top_io pid 2}${goto 300}${top_io io_write 2}
]]

使用conky监控硬件
https://fu01.github.io/posts/8c9615b/
作者
Fu01
发布于
2026年7月1日
许可协议