背景
使用htop命令时,可能界面是这样的,只能看到CPU部分,无法看到进程的相关信息。
原因
因为CPU核心数过多,每个CPU占用一行,导致看不到下面的进程信息。
解决方法:
方法一:重新配置htop
可以直接删除或重命名 htoprc 配置文件,再重新启动htop命令的时候,htop会根据相关输出信息自动调整到合适的显示方式。
配置文件位置:~/.config/htop/htoprc
也可以手动修改配置文件内容实现更高密度的CPU显示
$ vim ~/.config/htop/htoprc
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=1
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=1
show_program_path=1
highlight_base_name=0
highlight_megabytes=1
highlight_threads=1
tree_view=0
header_margin=1
detailed_cpu_time=1
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=AllCPUs Memory Swap # 修改此行
left_meter_modes=1 1 1
right_meters=Tasks LoadAverage Uptime # 修改此行
right_meter_modes=2 2 2 # 修改此行
重启恢复正常