11

I'm new to Ubuntu and new here. I need to know this.

How do I kill a single thread from Terminal in Ubuntu? I have mozilla opened and it has 45 threads. I want to kill one of it.

I've already search many sources online but to no avail. Can anyone help me?

Daren Tan
  • 111
  • 1
  • 1
  • 3

3 Answers3

7

You can't. Not without killing the whole process. From man 3 pthread_kill, a function used for signal handling:

NOTES
   Signal dispositions are process-wide: if a signal handler is installed,
   the  handler  will  be  invoked  in  the  thread  thread,  but  if  the
   disposition  of  the signal is "stop", "continue", or "terminate", this
   action will affect the whole process.

Also see this U&L post.

muru
  • 207,228
0

This seems to be what tgkill is for, but it's unlikely the best way to deal with too many threads opened by application. It should be treated as a sort of debugging tool.

Vi.
  • 220
-1

In terminal type:

kill -9 "pid number for the process"

For example:

kill -9 5624 (number 9 is the code for kill signal)

To get the PID number for the process either use:

ps -eLF

or you could use the command:

top

Every process will have it's own PID number. The reason for this is because processes can be named the same.