21

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.

  • 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. – Peter Nerlich Mar 14 '15 at 19:17
32

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.

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

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

| improve this answer | |
5

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 ....

| improve this answer | |
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.