First and foremost, every process in Linux has an ID, so-called PID. I want to catch self termination (not only upon request from another process) . Whenever we create a new process via fork() [or clone()] system call, a next spare PID is assigned to it by the kernel. These commands can be used with any type of process, graphical or command line, foreground or background. killall. One of my biggest pet peeves as a Linux sysadmin is when I see users, or even other sysadmins using kill -9 on the first attempt to terminate a process. So you want to be notified about the termination of a process, e.g. If termination of a process causes a process group to become orphaned, and some member is stopped, then all are sent first SIGHUP and then SIGCONT. bash$ pidof kate 9876. the output 9876 is the process id. The reason this bugs me so much is because it shows either a lack of understanding of the kill command or just plain laziness. catching the parent process termination. However, when you wind up with a really feisty process, the kill command is the way to go. bash$ ps aux | grep kate. – Lunar Mushrooms Jan 31 '14 at 7:04 If the abort() function causes process termination, all open streams are closed and flushed.. When I wind up with a stubborn process, I tend to start off with the killall command as it is the most efficient route to termination. For example, by Ctrl+\, Ctr+C, or assert, crash etc. A process group is called orphaned when the parent of every member is either in the process group or outside the session. This results in the abnormal termination of the process unless the SIGABRT signal is caught and the signal handler does not return (see longjmp(3)).. The abort() first unblocks the SIGABRT signal, and then raises that signal for the calling process. Here comes the great power of Linux and this is one of the reasons, why Linux is running on 90% of servers, on the planet. Linux processes basics. To find the process id of a process named kate, you can do. So SIGTERM and SIGKILL are not the only signals that need to be handled. The kill Command Linux Operating System comes with kill command to terminate a process. In particular, the process group of the session leader is always orphaned. killall is a Linux specific command that can be used to kill all running some program foo.. BTW, if that process behaves well, you might use atexit(3) inside the source code of foo.Then, if that program exits correctly (by calling exit(3) explicitly, or by returning from main; the crt0 is calling exit(3) in such case just after main returned), the registered routine is running when you want. Linux provides the kill, pkill, and killall commands to allow you to do just that. Learn more about Linux through the free “Introduction to Linux” course from The Linux Foundation and edX. You can also use the ps command and grep for the process name, as. The command makes it possible to continue running the server without the need to reboot after a major change/update. I need a single place where I can handle all the cases. “Killing” a process just means “forcing the process to quit.” This may be necessary if the process is refusing to respond.