Where Does htop Store Its Configuration File?

The htop interactive process viewer stores its user configuration file within the user’s home directory under the standard XDG Base Directory specification. For most modern Linux distributions, this file is located at ~/.config/htop/htoprc. This article covers the exact file paths for various system configurations, explains how the file is generated, and outlines how to safely back up or reset your custom settings.

The Standard Configuration Path

By default, htop adheres to modern Linux desktop standards by placing its configuration files inside the hidden .config directory of your home folder.

If you have customized your environment variables and defined a specific XDG_CONFIG_HOME, htop will respect that setting. In that scenario, the tool looks for the configuration at $XDG_CONFIG_HOME/htop/htoprc.

Legacy and Alternative Locations

On much older Linux distributions, or versions of htop released prior to the adoption of the XDG standard, the configuration was stored directly in the root of the home directory.

Modern versions of htop will still check for this legacy file as a fallback. If the legacy file exists, the application will read from it to ensure backward compatibility with your older settings.

How the htoprc File is Created

When you install htop for the first time, the htoprc file does not exist automatically. The application runs using its built-in default settings.

The file is generated the moment you alter a setting within the program. Pressing F2 or S opens the setup menu, where you can change the meters, adjust colors, or toggle display options. When you exit the menu or quit the application, htop automatically creates the htop/ directory and writes your preferences to the htoprc file.

Managing Your Configuration File

Because the htoprc file is a plain text file, it can be easily managed using standard command line tools.

Backing Up Settings

To save your custom layout, color scheme, and column selections before testing new setups, copy the file to a backup location:

cp ~/.config/htop/htoprc ~/.config/htop/htoprc.bak

Resetting to Defaults

If your configuration becomes corrupted or you want to revert to the original layout, you can safely delete the file. htop will revert to its factory defaults on the next launch:

rm ~/.config/htop/htoprc