Commands.page Logo

How to Send Custom Signal to Process in htop on Ubuntu

This guide explains how to send custom signals to processes using htop on Ubuntu. It covers navigating the interface, selecting processes, and choosing specific signal types to manage system resources effectively without needing complex command-line instructions.

Launch htop with Proper Permissions

To send signals to processes owned by other users or system services, you must run htop with elevated privileges. Open your terminal and enter the following command:

sudo htop

Running htop as root ensures you have the necessary permissions to terminate or signal restricted processes. If you only need to manage your own user processes, running htop without sudo is sufficient.

Select the Target Process

Once htop is open, use the up and down arrow keys to navigate through the list of running processes. You can sort the list by CPU or memory usage by clicking the respective column headers or pressing F6 to select a sorting criterion. Highlight the specific process ID (PID) you wish to signal.

Send the Signal Using F9

With the target process highlighted, press the F9 key. This opens the “Send signal” menu. You will see a list of available signals categorized by number and name. Common signals include:

Use the arrow keys to select the desired signal from the list. While SIGTERM and SIGKILL are standard, you can scroll through the full list to find custom signals relevant to your specific application needs.

Confirm and Execute

After selecting the signal number, press Enter to confirm. htop will send the signal to the process immediately. The process list will refresh, showing the updated status. If the process terminates, it will disappear from the list. If it ignores the signal or requires additional permissions, you may see an error message at the bottom of the screen.

Verify Process Status

Confirm that the signal had the intended effect by observing the process list. If the process remains active after sending SIGTERM, you may need to send SIGKILL. Always prefer graceful termination signals before forcing a kill to prevent data loss or corruption within the application.