htop: quick guide and customization

htop is an interactive system monitor, but also a process-viewer, process-manager, stress tool, and more. Sysadmins may choose to use htop when Unix top does not provide sufficient information about system processes.

htop uses a cursor-controlled interface to send signals to processes. An example where this comes in handy: You don’t need to type in the PID; Select one or more processes by using your mouse cursor or any other input device.

Although similar to top, htop also allows you to scroll vertically and horizontally, so you can view all the processes running on the system and view them as a process tree. Below is a screenshot of htop, which is named as a . Was taken from Stacklinux VPS Who is hosting this blog:

htop – how to customize it

Now for the fun part of customizing htop. Here is a quick guide. Open htop, use your mouse or touchpad to navigate. start by clicking to establish (bottom left) or by pressing F2 either shift + s, This will open the following screen:

htop setup

Almost all of us use top and htop. However, more often than not, we don’t make changes to our liking. (Also read: How to Customize Top Order And For Linux server performance analysis, here’s how:) From the above screen, you can tweak several settings. These settings are then saved in $HOME/.config/htop/htoprc

Here is a copy of my htoprc config file.

Feel free to copy, replace and tweak some more. Back up your config file first.

# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=50 0 48 17 18 38 39 40 2 46 47 49 1
sort_key=111
sort_direction=1
hide_threads=1
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=0
highlight_megabytes=0
highlight_threads=0
tree_view=1
header_margin=1
detailed_cpu_time=1
cpu_count_from_zero=1
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=6
delay=15
left_meters=CPU AllCPUs
left_meter_modes=2 1
right_meters=Blank Clock Uptime LoadAverage Tasks Swap Memory
right_meter_modes=2 2 2 2 2 2 2

htop tweaks for linux administrators

Following is a list of htop modifications to better suit Linux administration.

  • added detailed CPU usage line at the top (system/io-wait/hard-irq/soft-irq/theft/guest).
  • hide userland process thread, (Is only processes visible without scrolling MySQL threads? This fixes it. Alternative,
  • couple NLWP column, NLWP = Number of threads in a process. (like MySql) Useful when the above changes are made.
  • couple wide memory usage line, (mem/used/buffers/cache)
  • change process lists tree view,
  • Changed CPU number to start from 0.
  • Change the CPU cores in the 2 to 1 column. (higher # of cores may require more)

Here is a visual comparison. My tweaked configuration on the left and the default htop on the right. (full size image Here,

Tweaked htop config

Read also: htop and top alternatives: highlights, nmon,

Leave a Comment