Bootstrap FreeKB - Linux Commands - killall (end a process)
Linux Commands - killall (end a process)

Updated:   |  Linux Commands articles

The killall command can be used to end a process. For example, let's say the gedit program is running. The killall command followed by gedit will end the gedit process.

[john.doe@server1 ~]# killall gedit

 


SIGNALS

The killall command can use different signals. A signals represents how a process should be ended. For example, the terminate signal is less aggresive than the quit signal. Following are some of the common signals.

Signal Number Name
Hangup 1 sighup
Interupt 2 sigint
Quit 3 sigquit
Kill 9 sigkill
Terminate 15 sigterm

 

When a certain signal is not specified, the terminate signal is used. 

The killall command followed by the signal name or signal number can be used to end a process with a particular signal. In this example, the hangup signal is used.

[john.doe@server1 ~]# killall -1 gedit

 

In this example, the quit signal is used.

[john.doe@server1 ~]# killall -sigquit gedit

 


WORKING EXAMPLE

Let's take an example where gedit is opened in the foreground, and then Ctrl + Z is issued in the Terminal to stop gedit. Gedit remains open, and the killall command with the default terminate signal fails to end gedit.

 

In this scenario, using a different killall signal should end gedit. The killall signal (9) is able to end gedit.




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter e813c3 in the box below so that we can be sure you are a human.