Indonesia Website Awards
Indonesia Website Awards

In linux, there is a kill command available which functions to stop a process running that we want. For example, on my Linux desktop I run an application and the application has no response and then I can’t close it with the close button. I just need to end the process with the kill command, it’s easy isn’t it. For details, here’s how to stop running processes on linux:

Before we discuss the kill command, we need to know what a process ID (PID) is. PID is the id (which is generated automatically) of a process that is running. Well, we can combine this PID with the kill command to stop the running process. To check the PID and also the running processes, here are some commands that can be used:

  • ps -A : to find out all running processes and their PIDs,
  • pidof [processName] : to find the PID based on the name of the process,
  • ps aux : same as ps -A but the data presented is more diverse,
  • pgrep [processName] : same as pidof pidof [processName].

 

After understanding what PID is and how to check it, we can immediately use it to stop a running process with the kill command. Apart from the PID, we can also stop a running process with the name of the currently running process. The following commands can be used to stop the process:

 

Syntax Kill Command

The basic system for the kill command is kill [signal or option] PID . You can see the signal or option by running  kill --help , like this :

stop running processes on linux

kill –help

We can also use kill PID directly without using the options. Here’s an example of the kill command that I usually use:

  • kill 1234 – stops the process with PID 1234,
  • kill 5678 2463 7823 – stops multiple processes at once, will terminate processes with PID 5678, 2463 and 7823.

Then, as I said before, we can also stop the process using the process name, we can use the pkill command. Here’s an example that I usually use:

  • pkill mysqld – stops the process named mysqld.

For more details about the pkill command, you can see using pkill --help .

Next, if we want to stop all processes with the same name but have multiple ids, we can use the killall command. Here’s an example that I usually use:

  • killall chrome – for example here I stop the chrome browser application that runs with multiple PIDs.

 

Those are the commands that can be used to stop processes running on linux, we can use them according to our needs either using the kill, pkill or killall command. It’s all up to each of us.

 

Yep, that’s the information about how to stop running processes on Linux that I can share. Hopefully this information can be useful. Thank you: D

 

 

Also Read :

 

Categories: Linux

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *