How to Force Htop to Save Configuration Changes Immediately

The htop command-line utility is a powerful, interactive process manager for Linux, but users often find that custom settings—such as altered color schemes, hidden threads, or rearranged columns—revert to default after closing the application. This article provides a straightforward guide on how to force htop to save its configuration immediately, explains the manual save mechanics within the interface, and details how to directly edit the underlying configuration file.

Saving Configuration Changes Directly Within Htop

By default, htop is designed to save its configuration automatically when you exit the program cleanly using the designated exit commands. However, if your terminal session crashes, freezes, or you force-close the window, your modifications will be lost.

To ensure your settings are written to disk immediately without risking data loss, use the built-in setup menu:

  1. Open htop in your terminal.
  2. Press F2 (or S on some configurations) to enter the Setup menu.
  3. Make your desired changes (e.g., adding meters, changing display options, or adjusting colors).
  4. Navigate back to the main screen by pressing F10 or Esc.
  5. To explicitly trigger an immediate save and exit cleanly, press F10 or q from the main dashboard.

Note: Avoid closing the terminal window or pressing Ctrl + C to exit htop. Abruptly killing the process prevents the tool from executing its write-to-disk sequence, causing all recent changes to be discarded.

Verifying and Editing the Htop Configuration File

If htop still refuses to preserve your settings, the issue usually stems from file permissions or a missing directory structure. htop stores its configuration in a specific path relative to the user’s home directory.

The standard location for the configuration file is: ~/.config/htop/htoprc

Step-by-Step Troubleshooting

If your changes are not updating, verify the environment using the following steps:

When you edit and save the htoprc file directly in a text editor, the changes take effect the exact next time you launch htop.