Saturday, August 13, 2022
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Glossary
  • Community Forum
  • Web Hosting Directory
  • Login
  • Register
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Network/Internet
    • Windows
    • Software
    • Hardware
    • Blockchain
    • Policy/Legislation
    • How-Tos
    • Troubleshooting
No Result
View All Result
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Network/Internet
    • Windows
    • Software
    • Hardware
    • Blockchain
    • Policy/Legislation
    • How-Tos
    • Troubleshooting
No Result
View All Result
Cloud7 News
No Result
View All Result

Home > How-Tos > How to kill a process in Linux?

How to kill a process in Linux?

Killing a process may seem complicated for Linux beginners. In reality, it's effortless. This tutorial explains how to kill a running process on Terminal on Linux.


Ugur Kubilay Cam Ugur Kubilay Cam
September 27, 2021
3 min read
How to kill a process in Linux

To kill a running process, you must find out the process id or process name on the Linux console (Terminal). As an example we will find and kill the mysql service.

Table of Contents

  • Step 1: View and locate the running process
    • “top” interface
    • “ps” command
    • “pgrep” command
    • “pidof” command
  • Step 2: Killing process
    • “kill” command
    • “killall” command
    • “pkill” command
    • “kill -9” command
    • “xkill” command
    • “top” interface

Step 1: View and locate the running process

“top” interface

The top command is used for real-time monitoring of running processes on Unix and Linux operating systems.

Usage:

[email protected]:~$ top

or you can use it with the grep command to search for a specific process.

[email protected]:~$ top | grep mysql

Output:

"top" command in linux terminal


“ps” command

The “ps” command lists the processes currently running in the operating system. If you want the running processes to be displayed in real time, you can use the top command. The ps command can take with it three commonly used parameters a, u, and x. This command shows all running processes and process owners in the system and terminals.

Usage:

[email protected]:~$ ps aux

or you can use it with the grep command to search for a specific process.

[email protected]:~$ ps aux | grep mysql

Output:
ps aux command in linux terminal


“pgrep” command

“pgrep” is a command firstly written for the Solaris 7 operating system. It was later refactored for Unix and different BSDs. It prints the ID of the named processes.

Usage:

[email protected]:~$ pgrep mysql

Output:
pgrep command in linux terminal


“pidof” command

Pidof is an application that returns the IDs of running processes like pgrep.

Usage:

[email protected]:~$ pidof <process Name>

Sample:

[email protected]:~$ pidof mysql

Output:
pidof command in linux terminal

 


We have obtained the ID (1111) and process name (mysql, mysqld) of the Mysql service, now let’s see how to kill/terminate this process.


Step 2: Killing process

On Linux, you can kill a process using the killall, pkill, kill, kill -9, xkill and top commands. Let’s see how to kill a process using these commands in Linux terminal.

“kill” command

“kill” is a command to stop processes running on Unix and Linux by signaling them.

Usage:

[email protected]:~$ kill <Process ID>

Sample:

[email protected]:~$ kill 1111
[email protected]:~$ _

“killall” command

killall is a command to kill the processes named.

Usage:

[email protected]:~$ killall <Process Name>

Sample:

[email protected]:~$ killall mysqld
[email protected]:~$ _

“pkill” command

“pkill” is a command that was also developed for the Solaris 7 operating system and is used to kill running processes by sending signals such as kill and killall commands.

Usage:

[email protected]:~$ pkill <Process Name>

Example:

[email protected]:~$ pkill mysqld
[email protected]:~$ _

“kill -9” command

Unlike the kill command, the kill -9 command is often used to definitively kill unresponsive processes. The kill command signals gracefully, while the kill -9 command is more vulgar at killing processes. Alternatively, it can be run with the -SIGKILL parameter instead of -9.

Usage:

[email protected]:~$ kill -9 <Process ID>

or

[email protected]:~$ kill -SIGKILL <Process ID>

Sample:

[email protected]:~$ kill -9 1111
[email protected]:~$ _

or

[email protected]:~$ kill -SIGKILL 1111
[email protected]:~$ _

“xkill” command

xkill is often used to force-kill GUI applications. It is quite useful in killing some unresponsive applications that cause the system to work abnormally.

Usage:

[email protected]:~$ xkill <Process ID>

Sample:

[email protected]:~$ xkill 1111
[email protected]:~$ _

“top” interface

You can kill running processes using the “Top” interface. Press the “k” key while running the “top” interface, enter the process ID and press “enter”.

Usage:

[email protected]:~$ top

Sample:

kill process using top interface linux

Leave a Reply Cancel reply

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

I agree to the Terms & Conditions and Privacy Policy.

Next Post
Data center market to reach $517.17 billion by 2030

Global data center market to reach $517.17 billion by 2030

Related News

snap app of the week motrix

Snap app of the week: Motrix

August 13, 2022 1:00 pm
Ubuntu 22.04.1 is now available for download after a little delay

Ubuntu 22.04.1 is now available for download after a little delay

August 12, 2022 7:35 pm
Kali Linux 2022.3 is available with five new tools

Kali Linux 2022.3 is available for download, delivering five new tools

August 11, 2022 3:05 pm
Rescuezilla-2.4-released

Rescuezilla 2.4 released with fixes and enhancements

August 9, 2022 5:25 pm
Get free daily newsletters from Cloud7 News Get the Cloud7 Newsletter

Check your inbox or spam folder to confirm your subscription.

By subscribing, you agree to our
Copyright Policy and Privacy Policy

Get the Cloud7 Newsletter

Sign up for the Cloud7 Newsletter to receive the latest IT business updates straight to your inbox daily.

Check your inbox or spam folder to confirm your subscription.

Editor's Choice

Interview with Igor Seletskiy on AlmaLinux

7 best hosting control panels

How to update Linux Kernel without rebooting?

7 best Linux mail servers for 2022

7 best cPanel alternatives for 2022

7 best Linux web browsers for 2022

7 best CentOS alternatives

7 best Linux server distros for 2022

How to scan your server for Log4j (Log4Shell) vulnerability

10 Best Web Hosting Services of 2022

AlmaLinux 8.6 Stable is ready to download

Ubuntu 22.04 LTS is available for download. What is new?

Kali Linux 2022.2 is ready for download

Recent News

  • [Event] WordPress: Don’t underestimate the power of plugins
  • Snap app of the week: Motrix
  • We might need DNA storage systems by 2030
  • Rackspace achieved QSAC status for PCI DSS across EMEA
  • Ubuntu 22.04.1 is now available for download after a little delay


Cloud7 is a news source that publishes the latest news, reviews, comparisons, opinions, and exclusive interviews to help tech users of high-experience levels in the IT industry.

EXPLORE

  • Web Hosting
  • Cloud Computing
  • Data Center
  • Cybersecurity
  • Linux
  • Network/Internet
  • Software
  • Hardware
  • How-Tos
  • Troubleshooting

RESOURCES

  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Glossary
  • Community Forum
  • Web Hosting Directory

Get the Cloud7 Newsletter

Get FREE daily newsletters from Cloud7 delivering the latest news and reviews.

  • About
  • Privacy & Policy
  • Copyright Policy
  • Contact

© 2022, Cloud7 News. All rights reserved.

No Result
View All Result
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Network/Internet
    • Windows
    • Software
    • Hardware
    • Blockchain
    • Policy/Legislation
    • How-Tos
    • Troubleshooting
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Glossary
  • Community Forum
  • Web Hosting Directory

© 2022, Cloud7 News. All rights reserved.

Welcome Back!

Sign In with Facebook
Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Facebook
Sign Up with Google
Sign Up with Linked In
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.