Steps to Kill a Process in Linux/Unix

A computer method refers to a computer program having a unique method identification or additionally known as PID. Basically, on the Linux operating system, a method could also be running within the background, foreground or could also be in a suspended state. it’d attainable that on Linux, the OS shell may not return the prompt to the end-user unless this method that’s running is finished. As a result, several processes that take a considerable amount of your time to execute and keep you from utilizing the console till the method is finished running.

For Linux users the most common problem that arises is to kill or background a method so different tasks are conducted on the system. so as to kill a method, a signal has to be sent using the Linux kill command.

Following are the steps that show using “kill” command how to kill a Linux process ?

Step 1: For the running process on your system which you want to kill enter the below Linux command to get the PID.

ps myProcess

Once you enter the above command it’ll come back with one thing the same as the following:

PID TTY TIME CMD
1234 dz07 0:50 edit myBook
1235 dz07 0:47 -csh

Step 2: As the first process mentioned in the example above, enter the following Linux kill command to terminate :

To terminate the second active process enter the following command:

kill -1 1235

Step 3: It might happen in some case the kill -1 does not work, for these you need to use the -9 argument to clear the process from your system. Use the command as follow:

kill -9 1234

kill -9 1235

Step 4: Instead by using the killall command you can also kill all the instances of a given process . Enter the command as shown below:

killall <pname>
<pname> refer to the process name.

As it requires root access to the server, this tutorial is applicable only on VPS or a Dedicated Server, .