Best Telegram Programming Groups For Coders &Developers   It Wasn’t Me - Secure Your Account   Mr.Robot All Seasons 1,2,3 Full | Free Torrent Download   Mr.Robot All Seasons 1,2,3,4 Full | Watch Online [FREE]   5 Tips Will Keep You Safe During Christmas Holiday’s Online Shopping   You Can Get All Adobe Apps For $30 a Month Right Now   How To Wipe An iPhone Clean (ERASE) Before Selling?   Programming Languages To Learn To Be An Expert Hacker!   Cybercriminals exchange tips on underground forums about avoiding arrests   A comprehensive look into emerging Signal encrypted messaging application   A Detailed Comparison of WhatsApp, Telegram & Signal   How Telegram End-to-end Encryption Works To Provide Security ?   Flubot Malware is Spreading Quickly Through Android Devices   WhatsApp End-to-End Encryption and its Privacy Importance - Alternatives,Signal & Telegram   What is Credit Card Skimming And How To Protect Yourself From it ?   Where to hire react programmer and 3 essential skills to look for   Top 8 Basic Google Search Dorks [Live Examples]   [Penetration Testing] Top 70 Most Interview Questions   Why VPN Is Necessary ? [Detailed Guide]   Top 10 Dangerous Viruses Of All Times   List Of Common HTTP Error Status Codes   “Hello World!” Program In Different Programming Languages   100 Basic Computer Related G.K. Questions   Email Security - Tips And Tricks   Fonts Hub Collection (Free Design Resources)   Top 8 Softwares Free Download - No Credit Card Needed [2022 Update]   Shortcomings That Leads An Entrepreneur Towards Failure   5 Basic Steps To Protect Your Personal Data Online   What is Intel SGX and What are the Benefits ?   15 Things You Need to Know About Maintaining The Logs   How to think like a programmer - lessons in problem solving   How To Get Voice Like Anonymous Voice   Life Story of Microsoft Founder Bill Gates - Documentary   Own Private Search Engine in Linux Will Save Our Privacy   Best Etcher alternatives to Create Bootable USB   Music For Programming - Coding Music / Hacking Music   School Management Software v3.1 Premium + Crack   JavaFX Chat Client/Server + Source Code   Top 25 Keyword Research Tools [Search Engine Optimization]   A Quick SEO Checklist - 2023 Update   Online Domain Authority (DA) Rank Checker Websites   33 Things In SEO For Which Google Will Give Your Student Blog High Positions   How to Close the Site from indexing using robots.txt   10 SEO Tools all Small Businesses Need in 2023   Earth Rise Application + Code   Animation along a path + Code   Zen Pong Game in Java Language + Code   Simple Flying Bird Game + Code Files   Game Snake Simple + Code Files   The Space 'Sun & Earth' | HTML,CSS,JavaScript   File System in Web (Explorer in Windows and Finder in OSX)   Admin Dashboard Template built using Bootstrap + Code   Website Template For Admin Dashboard + Code   Youtube Playlist Downloader Script   How To Create A Stopwatch In Python   Python TicTacToe with Tk and minimax AI   Deskreen turns any device with a web browser into a secondary screen for your computer   Download Algorithms Book | Dummies Store   OSI Model And TCP/IP Model   How to Fix SSH Failed Permission Denied (publickey,gssapi-keyex,gssapi-with-mic)   What Is Load Balancing? Definition and How It Works   How to Setup FTP Server on Your Raspberry Pi   Download Windows 10 Lite Edition x64 | Direct Link   How To Recover Permanently Deleted Files In Windows 10 ?   How to make Fake Error Message Script in Windows   20 Essential Windows keyboard Shortcuts that will make you forget your mouse   How To Fix The DLL Missing Error In Windows 7 ?   Create Hotspot on Windows 10 in 6 steps   Download Microsoft Office Professional Plus 2016   Download DriverPack Solution Offline | Full   How To Create Simple And Password Protected ZIP File in Linux   2 Ways To Save Terminal Output of a Command in Linux   6 Best Tools to Monitor Disk IO Performance in Linux   Top 15 Best Websites (Blogs) to Learn Linux Online   How to Delete files older than 30 Days in Linux   What is the difference between apt and apt-get command   Fail2Ban Installation & Setup: Ubuntu, CentOS, Fedora & Debian   How to List Running Processes in Linux   How to Use the who Command in Linux with Examples   FOREMOST - Recover Permanently Deleted Files Easily in Kali Linux   Funny Linux Commands to Try   Command line interface guidelines, to help you write better command-line programs ...   How to Install Google Chrome Web Browser on Ubuntu 20.04   Learn Adobe Photoshop | 33 Episode Course   Window Privilege Escalation: Automated Script   Linux Privilege Escalation: Automated Script   How To Retrieve & Decrypt Stored Passwords in Firefox & Chrome Remotely   ACLight: An Advanced Privileged Account Discovery Tool   How to change Lock Screen Background on Kali Linux XFCE   Best 20 Kali Linux Tools For Hacking And Penetration Testing   How to Run Windows Application and Games on Kali Linux   How to run C and C++ programs in Kali Linux   Control Kali Linux PC From any Mobile or Tablet   How to Enable root User Account in Kali Linux   How to Configure Static IP address in Kali Linux   Bash vs ZSH in Kali Linux   [Solved] E: Unable to locate package in Kali Linux   Hosting a Local Website with Domain Name on Kali Linux over WiFi   Install Docker in Kali Linux and Run Other OS   How to Install Kali Linux | A Total Guide to Install Kali Linux   NetHunter Rootless - Official Kali NetHunter for non rooted phones   How to set up own VPN server in 10 minutes on Kali Linux using OpenVPN   Configuring The ProxyChains   Install Python3 in Kali Linux   TempoMail - Command Line Temporary Email in Linux   NIPE - Fully Anonymize Total Kali Linux System   How to Install Google Chrome & Chromium on Kali Linux [Official Method]   15 Best Laptops For Kali Linux & Cyber Security - Check This Before Buy   Volatolity - Digial Forensic Testing of RAM on Kali Linux   Limit the Internet Speed of LAN Users [Evil Limiter]   Find Virtual Machine IP Through Kali Linux - 3 Methods   Privilege Escalation with PowerShell Empire and SETOOLKIT [Kali Linux]   How to use kill, pkill and killall Commands to Kill any Linux Process   20 Useful Tar Commands For Extraction and Compression   Create a Fake AP with DNSMASQ and HOSTAPD [Kali Linux]   How to Fully Anonymize Your Linux System with Tor using Nipe   Hack Windows/Linux using ARCANUS Framework – 100% FUD   Simple and Target Mac Flooding - Kali Linux   Get Free Kali Linux on AWS with Public IP - Real Time Penetration Testing   What’s the difference Between Tails and Tor browser?   Does Tor Hide you From Your ISP? Should I surf internet using Tor ?   Wireshark for Pentester: Decrypting RDP Traffic   Exploit Wi-Fi Vulnerabilities with Routersploit on Termux and Linux   Man in The Middle Attack & How To Prevent it   Masscan - 1000 Times Faster Than NMAP   Wireshark - Shark in Wires | Network Protocol Analyzer in Kali Linux   Wifite - Easy Automated Wireless Attack   WiFi-Pumpkin 3 - Dangerous Access Point   Evil Twin Attack with DNSMASQ - Wireless WPA2-PSK Cracking   Sniffing with Rogue Access Point [DNSMASQ and TCPFLOW]   Hack Wi-Fi Settings of Windows Machine Remotely [After Meterpreter]   Wi-Fi deauthentication attack against 802.11 protocol   Bypass Hidden SSID in a Wireless Network [Full Proof Method]   Crack WPA/WPA2-PSK using Aircrack-ng and Hashcat   Crack WPA2-PSK Wi-Fi with automated python script - FLUXION PART 1   Set Default Version of Python : [SOLVED] update-alternatives: error: no alternatives for p   Python Scripting: Information Gathering and Automating Ethical Hacking   15 Essential Meterpreter Commands Everyone Should Know   Find Vulnerable Webcams with Shodan [Metasploit Framework]   TCP & SYN Scanning with Metasploit Framework without NMAP   Meterpreter Useful Top 60 Commands List   The Web Application Hacker's Handbook 2   Hacking GPS Book   MadCam - Termux Hack Front camera by Sending link   How to Download Files In Termux   IPdrone Termux - Find Location of Person it IP in Termux   ReconDog Termux - Best Reconnaissance Tool For Termux   Termux SSH: Use Termux in Windows Using SSH Server   How to Install and Use Fsociety-Tool In Termux   Termux-YTD : Download Youtube Videos with Termux   Use CMatrix Package Like a Pro   L3MON - Access Android Devices Remotely   Hack Android using Metasploit over LAN/WAN   Ghost Framework - Control Android Devices Remotely   Top 10 Vulnerable Android Applications [Penetration Testing]   Find Hidden Subdomains on Any Website with Subfinder   Blind Sql Injection with Regular Expressions Attack   Useful Google Dorks For Bug Bounty Hunters   HTML5 Security CheatSheet - What your browser does when you look away...   30,000 Sites Is In RISK, The Plus Addons For Elementor WordPress Plugin Hacked   WPScan - Find Vulnerabilities in WordPress Websites on Kali Linux   Wapiti - Automated Vulnerability Scanner   Generate 100% FUD Backdoor with TheFatRat - Windows 10 Exploitation   TheFatRat hacking tool to create undetectable backdoors   How to Make a Keylogger in Python + Code   How to create a keylogger in PowerShell ?   Backdoor Program using Python (Remote Access Explain)   Man in the Middle Attack with Websploit Framework   Hack Windows 10 Remotely over WAN with Metasploit [No Port Forwarding]   15 Powerful Gadgets For Ethical Hackers | Hardware Tools for Hackers   Find Vulnerabilities using NMAP Scripts (NSE)   Free Vulnerability Database And Resources   Firefox Browser Vulnerable to (MITM) Man-in-the-Middle Attack   Find Vulnerabilities in Military Networks By Participating Hack The Army Bug Bounty Progr. 


If a Linux process becomes unresponsive or is consuming too many resources, you may need to kill it.

Most processes have their own methods of shutting down. Unfortunately, processes can malfunction and not allow themselves to be shut down. If a running background process is unresponsive, it becomes necessary to use a command to kill it.

Here’s a complete guide on how to kill a Linux process using the command line.


What Processes Can You Kill in Linux?
Before killing or terminating a process, you need to consider permissions.

A root user can kill all processes. You can either add sudo before a command to run it as root, or obtain a root shell with su. Then execute the command.

Killing a process sends a termination message to the given process. There are multiple types of termination messages including:
  • SIGKILL – SIGKILL is the ultimate way of killing a process. It will always kill a process and will kill the process abruptly, generating a fatal error. SIGKILL should always work. If it does not work, the operating system has failed.
  • SIGTERM – SIGTERM attempts to kill a process, but unlike SIGKILL it may be blocked or otherwise handled. It can be considered a gentler way of attempting to terminate a process.
For most purposes, SIGKILL will be the fastest and most effective method to terminate the process.

Step 1: View Running Linux Processes
The top command is the easiest way to get a complete overview of the processes currently being run.

To view a list of all currently running processes, use the command:

The top command will reveal process IDs and users, in addition to the amount of memory and CPU power each process is using.


To kill processes directly from the top interface, press k and enter the process ID.

To exit the top interface, press q.

Step 2: Locate the Process to Kill
Before you can kill a process, you need to find it. There are multiple ways you can search for a process in Linux. Processes can either be located by a process name (or a partial process name) or a process ID (also known as a “pid”).

Locate a Process with ps Command
The ps command displays similar information to top, though it will not be in the form of an interface. Instead, the ps command provides a complete listing of running processes, formatted based on the tags you add.
ps <options>

The most common options to add to this is “-aux”:
  • -a. View processes of all users rather than just the current user.
  • -u. Provide detailed information about each of the processes
  • -x. Include processes that are controlled not by users but by daemons.
For example, the command ps -aux will return a detailed process list of all processes.


Finding the PID with pgrep or pidof
The Linux command pgrep is a more complex way of finding a process. This command will return processes based on specific selection criteria, which is known as the pattern. The pattern is a regular expression, such as a*, where * would be a wildcard.
pgrep <options> <pattern>

Here are the options that can be used with this command:
  • -l. List both the process names and the PIDs.
  • -n. Return the process that is newest.
  • -o. Return the process that is oldest.
  • -u. Only find processes that belong to a specific user.
  • -x. Only find processes that exactly match the given pattern.
The command pgrep -u root displays all processes owned by root. The command pgrep -u root 'a*' returns processes owned by root that start with the letter “a”.

The pidof command is used to find the ID of a process, provided that you know the name of the process.
pidof <options> <program>

A few options can be included, such as:
  • -c. Only return PIDs within a single root directory.
  • -o. Omit certain PIDs (include the processes to omit after the flag).
  • -s. Only return a single PID.
  • -x. Also returns PIDs of shells that are running scripts.
Step 3: Use Kill Command Options to Terminate a Process
There are a few different methods of killing a process in Linux, depending on whether you know the name of the process running, the pid of the process, or just how long the process has been running.

killall Command
The killall command is used to kill processes by name. By default, it will send a SIGTERM signal. The killall command can kill multiple processes with a single command.
killall <process>

Several options can be used with the killall command:
  • -e. Find an exact match for the process name.
  • -I. Ignore case when trying to find the process name.
  • -i. Ask for additional confirmation when killing the process.
  • -u. Only kill processes owned by a specific user.
  • -v. Report back on whether the process has been successfully killed.
In addition to killing processes based on name, the killall command can also be used to kill based on the age of the process, using the following commands:
  • -o. Use this flag with a duration to kill all processes that have been running more than that amount of time.
  • -y. Use this flag with a duration to kill all processes that have been running less than that amount of time.
The killall -o 15m command will kill all processes that are older than 15 minutes, while the killall -y 15m command will kill all processes that are less than 15 minutes.

pkill Command
The pkill command is similar to the pgrep command, in that it will kill a process based on the process name, in addition to other qualifying factors. By default, pkill will send the SIGTERM signal.
pkill <options> <pattern>

pkill options include:
  • -n. Only kill the newest of the processes that are discovered.
  • -o. Only kill the oldest of the processes that are discovered.
  • -u. Only kill the processes that are owned by the selected user.
  • -x. Only kill the processes that match the pattern exactly.
  • -signal. Send a specific signal to the process, rather than SIGTERM.
kill Command
If you know a process ID, you can kill it with the command:
kill <processID>

The kill command will kill a single process at a time with the given process ID. It will send a SIGTERM signal indicating to a process to stop. It waits for the program to run its shutdown routine.

The -signal command can be used to specify a signal that isn’t SIGTERM.

kill -9 Linux Command
kill -9
is a useful command when you need to shut down an unresponsive service. Run it similarly as a regular kill command:
kill -9 <processID>
kill -SIGKILL <processID>

The kill -9 command sends a SIGKILL signal indicating to a service to shut down immediately. An unresponsive program will ignore a kill command, but it will shut down whenever a kill -9 command is issued. Use this command with caution. It bypasses the standard shutdown routine so any unsaved data will be lost.

Your operating system is not running properly if a SIGKILL signal does not shut down a service.

top Command
The top command provides an interface through which a user can navigate through currently running processes.

To kill a specific process, insert k from the top interface and then enter in the desired process ID.


xkill command
The xkill command is a special type of command that closes a given server’s connection to clients.
xkill <resource>

If a server has opened a number of unwanted processes, xkill will abort these processes.

If xkill is run without specifying a resource, then an interface will open up that lets the user select a window to close.

Key Takeaways on Terminating a Linux Process
  • When a process cannot be closed any other way, it can be manually killed via command line.
  • To kill a process in Linux, you must first find the process. You can use the top, ps, pidof or pgrep commands.
  • Once you have found the process you want to kill, you can kill it with the killall, pkill, kill, xkill or top commands.
  • When killing a process, you can send a termination signal of SIGHUP, SIGKILL, or SIGTERM.
  • You need to have permission to kill a process, which you can gain through the use of the sudo command.
Note: Learn how to use the nohup command to block the SIGHUP signal and allow processes to complete even after logging out from the terminal/shell.

In this article, we covered several ways to kill processes in Linux. It is critical to learn and understand these Linux termination commands for system management and administration.