0

I know there are several ways to kill a process if I know the process id.

But similar to ctrl+C in keyboard interrupt, looking for such interrupt using a command.

Christian.K
  • 47,778
  • 10
  • 99
  • 143
amar19
  • 373
  • 1
  • 3
  • 16
  • 1
    How will you know which program to kill without an identifier? How is the program to be killed being run in relation to your program? – Carcigenicate Jun 14 '20 at 13:47
  • You can search the PID by searching the process name in the process tree (like `pgrep`). You use [`psutil`](https://pypi.org/project/psutil/) for that. – Laurent LAPORTE Jun 14 '20 at 13:49
  • @LaurentLAPORTE What if the current command is running in the terminal will I know the pid of that process in other terminal if I open a new terminal and run psutil? – amar19 Jun 14 '20 at 13:51
  • Does this answer your question? [How to process SIGTERM signal gracefully?](https://stackoverflow.com/questions/18499497/how-to-process-sigterm-signal-gracefully) – High-Octane Jun 14 '20 at 13:51
  • In a server, as I know, there is only one process tree. So, yes you can find your process, even if it is opened in another terminal. – Laurent LAPORTE Jun 14 '20 at 13:53
  • Maybe `killall ` will do? Disclaimer: that may kill more than you would have liked. –  Jun 14 '20 at 14:23

1 Answers1

0

use this Command to kill the process( killall -s 9 [process name] )