38

Sometimes I need to kill a process and for that purpose I enter htop, search (/) for some string and then intend to kill the associated process.

The problem is that usually the processes are in motion (due to new processes being added and attributes changing) - so by the time I pressed F9 and went on with "killing" the process the selected process is already a different one.

Is there a way to handle this?

The reason why I use htop is of course b/c I sometimes have to guess which is the right process to get rid of and just a string is not sufficient for identification.

1
  • I don't know if you can/have changed the update interval, but with the default one you at least could take care of pressing <kbd>F9</kbd> in the middle of that interval after you checked to have remained on the same process. Commented Mar 14, 2015 at 19:17

4 Answers 4

49

After executing sudo htop, just use the arrow keys to select the process you want to remove and then press either F9 or k then select which signal you want to send in the list (using the arrow keys) and press enter.

If you just to ask "politely" a process to quit use 3 SIGQUIT.

If you want to make sure the process quits use 9 SIGKILL.

2
  • 5
    The key is to use sudo for commands running as root. If you just run htop, it won't always close processes.
    – Sawtaytoes
    Commented Jul 6, 2019 at 3:11
  • 3
    SIGTERM is what I usually go for
    – simplename
    Commented Sep 11, 2019 at 22:53
15

It is possible to tag (and untag) a process with [space]. To the tagged process(es) the kill signal will be sent.

6

use htop and note down the PID of the process. Exit by entering q

then enter the command :

kill PID

If it is owned by the root, then :

sudo kill PID

Hope this'll help you ....

3

First, press F6 which is the "sort by" option.

Then, under the "sort by" category on the left, select option PID and then press Enter. This should give you a more stable output.

Next, to locate a process, press F3 to search, type in the search, and then press F3 again to scroll through search results.

When the process is highlighted, press F9 two times quickly and then press 9 and then press Enter to kill the process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .