Kill or terminate a program in Linux

Hi folks,

Linux and Unix based distros have a command which can kill a process or application through terminal or simply can be done in Run applet(KDE) too.

The thing which we should need is to find out which process to kill, there are many ways to find out. Some of them are:

ps -A

The above command will list down all the process with PID, name and with other details. But this one is not may be the exact command we need.

pidof gedit

In the above command lets say we need PID of gedit to kill. So it will show the PID of gedit.

Now lets kill this process by using its PID. For example PID is 3154.

kill 3154

NOTE: We need to have root privileges to kill the process. So become root to carry out the process.

If the above command does not work, so we have another one to forcefully kill the process:

kill -9 3154

Now, if you want to kill all process related to one application, we can use killall command. This is just specific to Linux systems only. Lets say we want to kill firefox.

killall firefox

But, usually we don’t need this, because kill will do most of the work we want it to do.