End a process using the KILLALL command in Linux

Home > Search > Linux commands
  by

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.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments