How to Install Htop on Fedora 40 or 39

Htop is an interactive process viewer for Unix systems, providing a dynamic real-time view of the system’s processes, resource usage, and overall performance. It is a more user-friendly and feature-rich alternative to the traditional ‘top’ command, offering color-coded metrics, easy-to-use controls, and the ability to scroll vertically and horizontally through process lists. Htop is particularly useful for monitoring system performance, identifying resource-heavy processes, and managing running tasks with ease.

On Fedora 40 or 39, you can install Htop through the command-line terminal using the DNF package manager with Fedora’s AppStream. This method ensures a straightforward installation process and provides you with a stable version of Htop that integrates seamlessly with your system. This guide will walk you through the steps to install and use Htop on your Fedora system.

Update Fedora Linux Packages Before Htop Installation

Ensure your Fedora Linux system is up-to-date to prevent conflicts during the Htop installation. Updating packages is a crucial step, as it ensures compatibility and security.

To update your system, execute the following command in the terminal:

sudo dnf upgrade --refresh

This command will check for available updates and apply them, keeping your system’s packages current.

Install Htop via DNF Command

Once your Fedora Linux system is updated, you can install Htop. Htop is installed using DNF, Fedora’s package manager, simplifying the installation process.

To install Htop, use the command:

sudo dnf install htop

Confirm Htop Installation

After running this command, DNF will handle the download and installation of Htop. Once the installation is complete, it’s good practice to verify the installation.

To confirm Htop’s installation and check its version, use:

htop --version

This command will display the version of Htop installed on your Fedora Linux system, confirming that the installation was successful.

Htop Keyboard Shortcuts

Below is a detailed list of the most commonly used shortcuts within Htop:

Navigation and Process Management

  • Arrow Keys (←, ↑, →, ↓): Scroll through the process list to view different processes.
  • Shift + U: Clears all process selections (removes all tags).
  • Period (.) or Comma (,): Start an incremental search to find a process by its PID (Process ID).
  • F1, ?, H: Access the help screen for more information about Htop’s features.
  • U: Display processes belonging to a specific user.
  • F2, Shift + S: Open the settings menu to customize Htop’s appearance and behavior.
  • Shift + H: Toggle the display of user threads on or off.
  • F3, Shift + /: Initiate an incremental search by process name.
  • Shift + K: Toggle the display of kernel threads on or off.
  • F4, \: Apply a filter to list processes by name.
  • Shift + F: Pin the cursor to a specific process for tracking.

Viewing and Sorting Options

  • F5, T: Switch between the default list view and a tree view of processes.
  • Plus (+), Minus (-): Expand or collapse branches in the tree view.
  • F6, >: Choose a column to sort the process list.
  • Shift + P: Sort processes based on their CPU usage.
  • F7: Decrease the Nice value of a process, affecting its priority.
  • Shift + M: Sort processes by memory usage.
  • F8: Increase the Nice value of a process to lower its scheduling priority.
  • Shift + T: Sort processes based on time.

Process Control and System Insights

  • F9, K: Terminate the selected process or processes.
  • L: Use the lsof command to list open files for a process.
  • F10, Q, Ctrl + C: Exit Htop.
  • S: Trace system calls using strace for selected processes.
  • Space Bar: Tag or select a process.
  • Shift + L: Use ltrace to track library calls of a process.
  • I: Monitor input/output statistics for processes.

Basic Htop Commands

Below are some essential Htop command examples commonly used in Fedora Linux. These examples offer insights into Htop’s capabilities and how to leverage them for efficient system management.

Sorting Processes by CPU Usage

htop --sort-key PERCENT_CPU

This command launches Htop and sorts processes based on their CPU usage. It’s beneficial for quickly identifying processes that are consuming significant CPU resources.

Displaying Processes of a Specific User

htop --user [username]

Replace [username] with the actual username to filter and display processes under that user. This command helps monitor a specific user’s activities.

Filtering Processes by Name

htop --filter [process_name]

This command allows you to start Htop with a filter applied to display only processes that match [process_name]. It is handy for focusing on specific applications or services.

Running Htop in Tree View

htop --tree

This command starts Htop in a tree view, showing the hierarchy of processes. It’s beneficial for understanding the parent-child relationships between processes.

Showing Only Active Running Processes

htop -F R

This will show all processes with the “R” state corresponding to running processes. You can also use the following regular expressions to match other activity states:

  • R: Running
  • S: Sleeping
  • T: Stopped
  • Z: Zombie

Managing Htop

Remove Htop

When you no longer need Htop on your Fedora Linux system or plan to replace it with a different monitoring tool, you can easily uninstall it. The process involves a simple command that removes Htop from your system entirely.

sudo dnf remove htop

After running this command, Htop and its configuration files will be entirely removed from your Fedora system.

Conclusion

Installing Htop on Fedora using the DNF package manager gives you a powerful tool for monitoring and managing system processes in real-time. The ease of installation and integration via Fedora’s AppStream ensures that Htop runs smoothly on your system. Regularly using Htop can help you maintain optimal system performance by quickly identifying and managing resource-intensive processes. Keeping Htop updated through Fedora’s package management system will ensure you continue to benefit from its features and improvements, making it an essential tool in your system administration toolkit.

Leave a Comment