šŸ•·ļø Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 39 (from laksa135)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ā„¹ļø Skipped - page is already crawled

šŸ“„
INDEXABLE
āœ…
CRAWLED
6 hours ago
šŸ¤–
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://phoenixnap.com/kb/how-to-kill-a-process-in-linux
Last Crawled2026-04-07 01:58:11 (6 hours ago)
First Indexed2019-04-12 17:04:04 (6 years ago)
HTTP Status Code200
Meta TitleHow to Kill a Process in Linux from Command Line?
Meta DescriptionLearn to find processes and kill processes in Linux ones using the kill, pkill, xkill, top, and killall commands.
Meta Canonicalnull
Boilerpipe Text
Home Ā» KB Ā» SysAdmin Ā» How to Kill a Process in Linux from Command Line? Topics: If a Linux process becomes unresponsive or consumes excessive resources, killing it may be the only solution. Most processes have their own methods of shutting down. Unfortunately, processes can malfunction and require running a command to manually kill them. This guide demonstrates how to kill a Linux process using the command line. Prerequisites A system running Linux. A user account with root privileges . Access to the terminal. How to Find Process ID or Process Name Before killing a process, you need to locate it. Processes can be found by the process name (or a partial process name) or the process ID (PID) . There are multiple ways to find a process in Linux : Via the ps command. Via the pgrep or pidof command. Via the top command . The sections below show different ways to search for a process in Linux. Locate a Process with ps Command The ps command provides a complete listing of running processes, formatted based on the specified command options. The syntax for the ps command is: ps [options] The most common options to add to ps are: -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 returns a detailed list of all processes: Find PID with pgrep or pidof The pgrep Linux command is a more complex way of finding a process. The pgrep command returns processes based on specific selection criteria, known as the pattern. The pattern is a regular expression, such as a* , where * is a wildcard. pgrep [options] [pattern] The options that can be used with pgrep are: -l . List the process names and the PIDs. -n . Return the newest process. -o . Return the oldest process. -u . Only find processes that belong to a specific user. -x . Only find processes that exactly match the given pattern. For example, the command pgrep -l -u root displays the names and PIDs of all processes owned by root: The pidof command is used to find the ID of a process using the process name. pidof [options] [program] Some of the options that pidof accepts are: -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 . For example, to get the PID of the snapd process, run pidof snapd : View Running Processes with top The top command is the easiest way to get a complete overview of the currently running processes. To view a list of all active processes, run the command: top The top command interactive mode starts, shows the process IDs, the users, the amount of memory and CPU power each process uses, the running time, etc. To exit the top Ā  interface, press q . How to Kill a Process Make sure to consider permissions before killing or terminating a process. A root user can kill all processes. Either add sudo before a command to run it as root, or obtain a root shell with the su command . Then, execute the termination command. Killing a process sends a termination message to the given process. There are multiple types of termination messages, including: SIGKILL - The ultimate way of killing a process. It always kills a process abruptly, generating a fatal error. SIGKILL should always work. If it doesn't, the operating system has failed. SIGTERM - It attempts to kill a process, but, unlike SIGKILL , it may be blocked or otherwise handled. It is a gentler way of terminating a process. For most purposes, SIGKILL is the fastest and most effective method to terminate the process. The sections below list the most commonly used commands for killing a process and provide the steps for using each command. killall Command The killall command kills processes by their name. By default, it sends a SIGTERM signal. The killall command can kill multiple processes with a single command. The syntax is: killall [process] The killall Ā command accepts several options: -e . Find an exact match for the process name. -I . Ignore the 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. The following example shows the use of the -i option, instructing killall to ask for confirmation before terminating the process: In addition to killing processes based on name, the killall command can also be used to kill based on the age of the process. Use the following commands: -o . Use this flag with a duration to kill all processes that have been running for more than that amount of time. -y . Use this flag with a duration to kill all processes that have been running for less than that amount of time. The killall -o 15m command kills all processes that are older than 15 minutes, while the killall -y 15m command kills all processes that have been active for less than 15 minutes. pkill Command The pkill command is similar to the pgrep command, in that it kills a process based on the process name, in addition to other qualifying factors. By default, pkill sends the SIGTERM signal. The syntax is: 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 owned by the specified user. -x . Only kill the processes that match the pattern exactly. -signal . Send a specific signal to the process, rather than SIGTERM . The following example demonstrates how to kill the newest process created by the user bosko : pkill -n -u bosko kill Command The kill command terminates processes via the process ID. The syntax is: kill [process ID] The kill command kills a single process at a time with the given process ID. It sends a SIGTERM signal instructing a process to stop. It waits for the program to run its shutdown routine. The -signal option can be used to specify a signal other than SIGTERM . kill -9 Linux Command kill -9 is used to shut down an unresponsive service. Run it similarly to the regular kill command: kill -9 [processID] Or: kill -SIGKILL [processID] The kill -9 command sends a SIGKILL signal to a service, shutting it down immediately. An unresponsive program ignores a kill command, but it shuts down whenever a kill -9 command is issued.Ā Use this command with caution since it bypasses the standard shutdown routine, and any unsaved data will be lost. xkill command The xkill Ā command is a special command that closes a given server's connection to clients. The syntax of the xkill command is: xkill [resource] If a server has opened some unwanted processes, xkill Ā aborts these processes. If xkill is run without specifying a resource, then an interface opens up to let the user select a window to close. For example: top Command The top command provides an interface through which a user can navigate the currently running processes. To start the interface, run the command: top To kill a specific process, press k when in the interface, and enter the PID of the process to terminate: 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. Conclusion This guide explained several ways to kill processes in Linux. It is critical to learn and understand these Linux termination commands for system management and administration. Next, check out our comprehensive article on Linux network commands , or take a sneak peek at our ultimate list of Linux commands . Was this article helpful? Yes No
Markdown
- [Call](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Support](tel:1-855-330-1509) - [Sales](tel:1-877-588-5918) - [Login](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Bare Metal Cloud](https://bmc.phoenixnap.com/) - [Admin Hub](https://admin.phoenixnap.com/) - [Partners](https://phoenixnap.com/partners) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/01-colocation-mobile.svg)COLOCATION](https://phoenixnap.com/colocation) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/02-colocation-plus.svg)Colocation Premier Carrier Hotel](https://phoenixnap.com/colocation) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/03-data-center-as-a-service.svg)Data Center as a Service Solutions for Digital Transformation](https://phoenixnap.com/colocation/data-center-as-a-service) - [Data Center as a Service Overview](https://phoenixnap.com/colocation/data-center-as-a-service) - [Hardware as a Service Flexible Hardware Leasing](https://phoenixnap.com/colocation/hardware-as-a-service) - [Bare Metal Cloud API-Driven Dedicated Servers](https://phoenixnap.com/bare-metal-cloud) - [Object Storage S3 API Compatible Storage Service](https://phoenixnap.com/object-storage) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/04-meet-me-room.svg)Meet-Me Room The Interconnectivity Hub](https://phoenixnap.com/colocation/meet-me-room) - [Meet-Me Room Overview](https://phoenixnap.com/colocation/meet-me-room) - [AWS Direct Connect Dedicated Link to Amazon Cloud](https://phoenixnap.com/colocation/aws-direct-connect) - [Google Cloud Interconnect Private Connectivity to Google Cloud](https://phoenixnap.com/google-cloud-interconnect) - [Megaport Cloud Router Simplified Multi-Cloud Connections](https://phoenixnap.com/offers/megaport-cloud-router) - [All Carriers Global Interconnectivity Options](https://phoenixnap.com/colocation/all-carriers) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/05-schedule-a-tour.svg)Schedule a Tour Guided Virtual Data Center Tour](https://phoenixnap.com/phoenix-data-center-virtual-tour) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/06-data-center-locations.svg)Data Center Locations Global Data Center Footprint](https://phoenixnap.com/colocation/data-center-locations) - [Data Center Locations Overview](https://phoenixnap.com/colocation/data-center-locations) - [Phoenix, AZ The Largest Fiber Backbone in the U.S.](https://phoenixnap.com/colocation/phoenix) - [Amsterdam, NL The Connectivity Hub of Europe](https://phoenixnap.com/colocation/amsterdam) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/01-bare-metal-cloud-platform.svg)BARE METAL CLOUD](https://phoenixnap.com/bare-metal-cloud) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/01-bare-metal-cloud-platform.svg)Platform API-Driven Dedicated Servers](https://phoenixnap.com/bare-metal-cloud) - [Platform Overview](https://phoenixnap.com/bare-metal-cloud) - [Infrastructure As Code DevOps Integrations](https://phoenixnap.com/bare-metal-cloud/infrastructure-as-code) - [BMC vs. Dedicated Servers Choose the Best Option](https://phoenixnap.com/bare-metal-cloud-vs-dedicated-servers) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/02-bare-metal-cloud-pricing.svg)Pricing Instance pricing and cost estimation](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Instance Pricing See All Configurations](https://phoenixnap.com/bare-metal-cloud/instances) - [Pricing Calculator Get an Estimate](https://phoenixnap.com/cloud-pricing-calculator) - [Network/IP Pricing Flexible IP Pricing](https://phoenixnap.com/bare-metal-cloud/ip-pricing) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/03-kubernetes-solutions.svg)Kubernetes Solutions Streamlined Kubernetes Management](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Rancher Deployment One-Click Kubernetes Deployment](https://phoenixnap.com/bare-metal-cloud/rancher-deployment) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/04-cpus.svg)CPUs Next Gen Intel Processors](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Xeon 6 6700-series with E-Cores Supercharge Cloud-Native Workloads](https://phoenixnap.com/bare-metal-cloud/intel-xeon-6-processors-with-e-cores) - [IntelĀ® Coreā„¢ i9 14900K Ideal for Gaming, Streaming, and Content Creation](https://phoenixnap.com/bare-metal-cloud/intel-core-i9-14900k) - [5th Gen Intel Xeon Scalable CPUs Boost Data-Intensive Workloads](https://phoenixnap.com/bare-metal-cloud/5th-gen-intel-xeon-scalable-processors) - [HPE Ampere Altra Q80-30 HPEĀ® ProLiant RL300 as a service](https://phoenixnap.com/bare-metal-cloud/hpe-proliant-rl300) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/05-alliances.svg)Alliances Technology Partnerships](https://phoenixnap.com/bare-metal-cloud/technology-ecosystem) - [Ecosystem Underlying Technologies](https://phoenixnap.com/bare-metal-cloud/technology-ecosystem) - [NetrisOS VPC networking on bare metal](https://phoenixnap.com/bare-metal-cloud/netris) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/06-storage-options.svg)Storage Options Flexible Storage Solutions](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Object Storage S3-Compatible Storage Solution](https://phoenixnap.com/object-storage) - [Network File Storage All-Flash Scale-Out Storage Resources](https://phoenixnap.com/network-file-storage) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/07-gpu-servers.svg)GPU Servers For AI/ML and HPC workloads](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux) - [Intel Max 1100 GPUs 1 system. 2 GPUs. Amazing performance.](https://phoenixnap.com/bare-metal-cloud/gpu-servers) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/01-hybrid-cloud-mobile.svg)HYBRID CLOUD](https://phoenixnap.com/security/data-security-cloud) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/02-hybrid-cloud-overview.svg)Hybrid Cloud Overview](https://phoenixnap.com/cloud-services/hybrid-cloud-solutions) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/03-object-storage.svg)Object Storage S3 Compatible Storage Solution](https://phoenixnap.com/object-storage) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/04-bare-metal-cloud.svg)Bare Metal Cloud API-Driven Dedicated Servers](https://phoenixnap.com/bare-metal-cloud) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/05-alternative-cloud-provider.svg)Alternative Cloud Provider Overcome Public Cloud Limitations](https://phoenixnap.com/cloud-services/alternative-cloud-provider) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/06-backup-solutions.svg)Backup Solutions Veeam-Powered Services](https://phoenixnap.com/backup-restore) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/07-disaster-recovery.svg)Disaster Recovery VMware, Veeam, Zerto](https://phoenixnap.com/disaster-recovery-as-a-service-draas) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/08-veeam-cloud-connect.svg)Veeam Cloud Connect Backup and Replication](https://phoenixnap.com/backup-restore/veeam-cloud-connect) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/09-managed-backup-for-microsoft-365.svg)Managed Backup for Microsoft 365 Veeam-Powered Service](https://phoenixnap.com/backup-restore/microsoft-365-backup) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/01-network-mobile.svg)NETWORK](https://phoenixnap.com/network) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/02-network-overview.svg)Network Overview Global Network Footprint](https://phoenixnap.com/network) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/03-network-locations.svg)Network Locations U.S., Europe, APAC, LATAM](https://phoenixnap.com/network/locations) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/04-speed-test.svg)Speed Test Download Speed Test](https://phoenixnap.com/network/speed-test) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/01-learn-mobile.svg)LEARN](https://phoenixnap.com/kb) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/02-blog.svg)Blog IT Tips and Tricks](https://phoenixnap.com/blog/) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/04-resource-library.svg)Resource Library Knowledge Resources](https://phoenixnap.com/company/resource-library) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/05-glossary.svg)Glossary IT Terms and Definitions](https://phoenixnap.com/glossary/) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/06-events.svg)Events Let's Meet\!](https://phoenixnap.com/company/it-events) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/07-newsroom.svg)Newsroom Media Library](https://phoenixnap.com/company/press) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/08-developers.svg)Developers Development Resources Portal](https://developers.phoenixnap.com/) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/09-apis.svg)APIs Access Our Public APIs](https://developers.phoenixnap.com/apis) - [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201%201'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2025/11/10-github.svg)GitHub Public Code Repositories](https://github.com/phoenixnap) [Home](https://phoenixnap.com/) Ā» [KB](https://phoenixnap.com/kb/) Ā» [SysAdmin](https://phoenixnap.com/kb/category/sysadmin) Ā» How to Kill a Process in Linux from Command Line? # How to Kill a Process in Linux from Command Line? ![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E) ![](https://secure.gravatar.com/avatar/8d4609e99e6aecc69ce049e18d45f033?s=200&d=mm&r=g) By [Vladimir Kaplarevic](https://phoenixnap.com/kb/author/vladimirk) Published: April 28, 2025 Topics: [commands](https://phoenixnap.com/kb/tag/commands), [linux](https://phoenixnap.com/kb/tag/linux) If a [Linux](https://phoenixnap.com/kb/what-is-linux) process becomes unresponsive or consumes excessive resources, killing it may be the only solution. Most processes have their own methods of shutting down. Unfortunately, processes can malfunction and require running a command to manually kill them. **This guide demonstrates how to kill a Linux process using the command line.** ![How to kill a process in Linux using the command line - a tutorial.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20400'%3E%3C/svg%3E) ![How to kill a process in Linux using the command line - a tutorial.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/how-to-kill-a-process-in-linux-from-command-line.png) Prerequisites - A system running Linux. - A user account with [root privileges](https://phoenixnap.com/glossary/what-is-root-access). - Access to the terminal. ## How to Find Process ID or Process Name Before killing a process, you need to locate it. Processes can be found by the process name (or a partial process name) or the [process ID (PID)](https://phoenixnap.com/glossary/process-id). There are multiple ways to [find a process in Linux](https://phoenixnap.com/kb/list-processes-linux): - Via the **`ps`** command. - Via the **`pgrep`** or **`pidof`** command. - Via the [top command](https://phoenixnap.com/kb/top-command-in-linux). The sections below show different ways to search for a process in Linux. ### Locate a Process with ps Command The **`ps`** command provides a complete listing of running processes, formatted based on the specified command options. The syntax for the **`ps`** command is: ``` ps [options] ``` The most common options to add to **`ps`** are: - **`-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](https://phoenixnap.com/glossary/what-is-a-daemon). For example, the command **`ps -aux`** returns a detailed list of all processes: ![The ps command output example on Linux.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%20274'%3E%3C/svg%3E) ![The ps command output example on Linux.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/ps-command-output.png) ### Find PID with pgrep or pidof The **`pgrep`** Linux command is a more complex way of finding a process. The **`pgrep`** command returns processes based on specific selection criteria, known as the pattern. The pattern is a regular expression, such as **`a*`**, where **`*`** is a wildcard. ``` pgrep [options] [pattern] ``` The options that can be used with **`pgrep`** are: - **`-l`**. List the process names and the PIDs. - **`-n`**. Return the newest process. - **`-o`**. Return the oldest process. - **`-u`**. Only find processes that belong to a specific user. - **`-x`**. Only find processes that exactly match the given pattern. For example, the command **`pgrep -l -u root`** displays the names and PIDs of all processes owned by root: ![Listing the running processes using the pgrep command.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%20310'%3E%3C/svg%3E) ![Listing the running processes using the pgrep command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/pgrep-command-output.png) The **`pidof`** command is used to find the ID of a process using the process name. ``` pidof [options] [program] ``` Some of the options that **`pidof`** accepts are: - **`-c`**. Only return PIDs within a single [root directory](https://phoenixnap.com/glossary/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](https://phoenixnap.com/glossary/what-is-a-script). For example, to get the PID of the **`snapd`** process, run **`pidof snapd`**: ![Getting the process ID using the pidof command.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%2046'%3E%3C/svg%3E) ![Getting the process ID using the pidof command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/pidof-command-output.png) ### View Running Processes with top The top command is the easiest way to get a complete overview of the currently running processes. To view a list of all active processes, run the command: ``` top ``` The **`top`** command interactive mode starts, shows the process IDs, the users, the amount of [memory](https://phoenixnap.com/glossary/physical-memory) and [CPU](https://phoenixnap.com/glossary/cpu-definition) power each process uses, the running time, etc. ![Listing running processes using the top command.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%20386'%3E%3C/svg%3E) ![Listing running processes using the top command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/top-command-output.png) To exit the **`top`**interface, press **q**. ## How to Kill a Process Make sure to consider [permissions](https://phoenixnap.com/kb/linux-file-permissions) before killing or terminating a process. A root user can kill all processes. Either add [sudo](https://phoenixnap.com/kb/linux-sudo) before a command to run it as root, or obtain a root shell with the [su command](https://phoenixnap.com/kb/su-command-linux-examples). Then, execute the termination command. Killing a process sends a termination message to the given process. There are multiple types of termination messages, including: - **`SIGKILL`** \- The ultimate way of killing a process. It always kills a process abruptly, generating a fatal error. **`SIGKILL`** should always work. If it doesn't, the [operating system](https://phoenixnap.com/glossary/operating-system) has failed. - **`SIGTERM`** \- It attempts to kill a process, but, unlike **`SIGKILL`**, it may be blocked or otherwise handled. It is a gentler way of terminating a process. For most purposes, **`SIGKILL`** is the fastest and most effective method to terminate the process. The sections below list the most commonly used commands for killing a process and provide the steps for using each command. ### killall Command The **`killall`** command kills processes by their name. By default, it sends a **`SIGTERM`** signal. The **`killall`** command can kill multiple processes with a single command. The syntax is: ``` killall [process] ``` The **`killall`** command accepts several options: - **`-e`**. Find an exact match for the process name. - **`-I`**. Ignore the 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. The following example shows the use of the **`-i`** option, instructing **`killall`** to ask for confirmation before terminating the process: ![Killing a process using the killall command.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%2047'%3E%3C/svg%3E) ![Killing a process using the killall command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/kill-process-using-killall.png) In addition to killing processes based on name, the **`killall`** command can also be used to kill based on the age of the process. Use the following commands: - **`-o`**. Use this flag with a duration to kill all processes that have been running for more than that amount of time. - **`-y`**. Use this flag with a duration to kill all processes that have been running for less than that amount of time. The **`killall -o 15m`** command kills all processes that are older than 15 minutes, while the **`killall -y 15m`** command kills all processes that have been active for less than 15 minutes. ### pkill Command The **`pkill`** command is similar to the **`pgrep`** command, in that it kills a process based on the process name, in addition to other qualifying factors. By default, **`pkill`** sends the **`SIGTERM`** signal. The syntax is: ``` 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 owned by the specified user. - **`-x`**. Only kill the processes that match the pattern exactly. - **`-signal`**. Send a specific signal to the process, rather than **`SIGTERM`**. The following example demonstrates how to kill the newest process created by the user **`bosko`**: ``` pkill -n -u bosko ``` ### kill Command The **`kill`** command terminates processes via the process ID. The syntax is: ``` kill [process ID] ``` The **`kill`** command kills a single process at a time with the given process ID. It sends a **`SIGTERM`** signal instructing a process to stop. It waits for the program to run its shutdown routine. The **`-signal`** option can be used to specify a signal other than **`SIGTERM`**. ### kill -9 Linux Command **`kill -9`** is used to shut down an unresponsive service. Run it similarly to the regular **`kill`** command: ``` kill -9 [processID] ``` Or: ``` kill -SIGKILL [processID] ``` The **`kill -9`** command sends a **`SIGKILL`** signal to a service, shutting it down immediately. An unresponsive program ignores a **`kill`** command, but it shuts down whenever a **`kill -9`** command is issued. Use this command with caution since it bypasses the standard shutdown routine, and any unsaved data will be lost. ### xkill command The **`xkill`** command is a special command that closes a given server's connection to clients. The syntax of the **`xkill`** command is: ``` xkill [resource] ``` If a server has opened some unwanted processes, **`xkill`** aborts these processes. If **`xkill`** is run without specifying a resource, then an interface opens up to let the user select a window to close. For example: ![Killing processes using xkill in Linux.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%2082'%3E%3C/svg%3E) ![Killing processes using xkill in Linux.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/kill-process-using-xkill.png) ### top Command The **`top`** command provides an interface through which a user can navigate the currently running processes. To start the interface, run the command: ``` top ``` To kill a specific process, press **`k`** when in the interface, and enter the PID of the process to terminate: ![Killing a process using the top command.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20730%20316'%3E%3C/svg%3E) ![Killing a process using the top command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/kill-process-using-top-command.png) **Note:** Learn how to use the [nohup command](https://phoenixnap.com/kb/linux-nohup) to block the **`SIGHUP`** signal and allow processes to complete even after logging out from the terminal/shell. Conclusion This guide explained several ways to kill processes in Linux. It is critical to learn and understand these **Linux termination commands** for [system management](https://phoenixnap.com/glossary/system-management) and administration. Next, check out our comprehensive article on [Linux network commands](https://phoenixnap.com/kb/linux-network-commands), or take a sneak peek at our [ultimate list of Linux commands](https://phoenixnap.com/kb/linux-commands). Was this article helpful? YesNo Contents - [How to Find Process ID or Process Name](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#How_to_Find_Process_ID_or_Process_Name) - [Locate a Process with ps Command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#Locate_a_Process_with_ps_Command) - [Find PID with pgrep or pidof](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#Find_PID_with_pgrep_or_pidof) - [View Running Processes with top](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#View_Running_Processes_with_top) - [How to Kill a Process](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#How_to_Kill_a_Process) - [killall Command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#killall_Command) - [pkill Command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#pkill_Command) - [kill Command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#kill_Command) - [kill -9 Linux Command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#kill_-9_Linux_Command) - [xkill command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#xkill_command) - [top Command](https://phoenixnap.com/kb/how-to-kill-a-process-in-linux#top_Command) Subscribe to our newsletter [SUBSCRIBE](https://phoenixnap.com/developers-monthly-newsletter) Next you should read [![Different methods for creating files in Linux.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20400'%3E%3C/svg%3E)![Different methods for creating files in Linux.](https://phoenixnap.com/kb/wp-content/uploads/2024/07/create-file-linux.png)](https://phoenixnap.com/kb/how-to-create-a-file-in-linux) [SysAdmin](https://phoenixnap.com/kb/category/sysadmin) [Web Servers](https://phoenixnap.com/kb/category/web-servers) [How to Create a File in Linux Using Terminal/Command Line](https://phoenixnap.com/kb/how-to-create-a-file-in-linux) [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20799%20400'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2022/08/how-to-list-users-in-linux.png)](https://phoenixnap.com/kb/how-to-list-users-linux) [SysAdmin](https://phoenixnap.com/kb/category/sysadmin) [Web Servers](https://phoenixnap.com/kb/category/web-servers) [How to List Users in Linux, List all Users Command](https://phoenixnap.com/kb/how-to-list-users-linux) [![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20400'%3E%3C/svg%3E)![](https://phoenixnap.com/kb/wp-content/uploads/2023/12/how-to-use-mkdir-to-create-linux-directory.png)](https://phoenixnap.com/kb/create-directory-linux-mkdir-command) [SysAdmin](https://phoenixnap.com/kb/category/sysadmin) [How to Use mkdir Command to Make or Create a Linux Directory](https://phoenixnap.com/kb/create-directory-linux-mkdir-command) [![Using the grep command in Linux.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20400'%3E%3C/svg%3E)![Using the grep command in Linux.](https://phoenixnap.com/kb/wp-content/uploads/2024/02/grep-command-linux.png)](https://phoenixnap.com/kb/grep-command-linux-unix-examples) [SysAdmin](https://phoenixnap.com/kb/category/sysadmin) [How To Use grep Command In Linux/UNIX](https://phoenixnap.com/kb/grep-command-linux-unix-examples) CONTACT US [Get a Quote](https://phoenixnap.com/contact-us) [Support (1-855-330-1509)](tel:1-855-330-1509) [Sales (1-877-588-5918)](tel:1-877-588-5918) - [Colocation](https://phoenixnap.com/colocation) - [Phoenix](https://phoenixnap.com/colocation/phoenix) - [Ashburn](https://phoenixnap.com/colocation/ashburn) - [Amsterdam](https://phoenixnap.com/colocation/amsterdam) - [Atlanta](https://phoenixnap.com/colocation/atlanta) - [Belgrade](https://phoenixnap.com/colocation/belgrade) - [Singapore](https://phoenixnap.com/colocation/singapore) - [Shipping Instructions](https://phoenixnap.com/colocation/shipping-instructions) RECENT POSTS ["Invalid Reference Format" Error in Docker: How to Fix](https://phoenixnap.com/kb/docker-invalid-reference-format) [Python dict() Function Explained](https://phoenixnap.com/kb/python-dict) [Ansible get\_url Module: Download Files from URL](https://phoenixnap.com/kb/ansible-get-url) [Docker Desktop: Unexpected WSL Error](https://phoenixnap.com/kb/docker-desktop-unexpected-wsl-error) [How to Check if a File Exists in Python](https://phoenixnap.com/kb/check-if-file-exist-python) - [Servers](https://phoenixnap.com/servers/dedicated) - [Bare Metal Cloud](https://phoenixnap.com/bare-metal-cloud) - [Dedicated Servers](https://phoenixnap.com/servers/dedicated) - [Database Servers](https://phoenixnap.com/servers/database) - [Virtualization Servers](https://phoenixnap.com/servers/virtualization) - [High Performance Computing (HPC) Servers](https://phoenixnap.com/servers/high-performance-computing-hpc) - [Dedicated Streaming Servers](https://phoenixnap.com/servers/streaming) - [Dedicated Game Servers](https://phoenixnap.com/servers/dedicated-game-servers) - [Dedicated Storage Servers](https://phoenixnap.com/servers/storage) - [SQL Server Hosting](https://phoenixnap.com/servers/sql-server-hosting) - [Dedicated Servers in Amsterdam](https://phoenixnap.com/dedicated-servers-amsterdam-netherlands) - [Cloud Servers in Europe](https://phoenixnap.com/cloud-services/cloud-servers-europe) - [Big Memory Infrastructure](https://phoenixnap.com/bare-metal-cloud/big-memory-infrastructure) - [Buy Now](https://admin.phoenixnap.com/wap-pncpadmin-shell/orderForm?bmbPath=/order-form?currencyCode=usd) - [BMC portal](https://signup.bmc.phoenixnap.com/) CLOUD SERVICES - [Data Security Cloud](https://phoenixnap.com/security/data-security-cloud) - [Managed Private Cloud](https://phoenixnap.com/private) - [Object Storage](https://phoenixnap.com/object-storage) - [Solutions](https://phoenixnap.com/infrastructure-solutions) - [Disaster Recovery](https://phoenixnap.com/infrastructure-solutions/disaster-recovery-services) - [Web Hosting Reseller](https://phoenixnap.com/reseller-hosting) - [SaaS Hosting](https://phoenixnap.com/infrastructure-solutions/saas-hosting) COMPLIANCE - [HIPAA Ready Hosting](https://phoenixnap.com/compliance/hipaa-compliant-hosting) - [PCI Compliant Hosting](https://phoenixnap.com/compliance/pci-compliant-hosting) - [Privacy Center](https://phoenixnap.com/) - [Do not sell or share my personal information](https://phoenixnap.com/) NEEDS - [Disaster Recovery Solutions](https://phoenixnap.com/infrastructure-solutions/disaster-recovery-services) - [High Availability Solutions](https://phoenixnap.com/infrastructure-solutions/high-availability-solutions) - [Cloud Evaluation](https://phoenixnap.com/offers/cloud-evaluation-demo) INDUSTRIES - [Web Hosting Providers](https://phoenixnap.com/reseller-hosting) - [Legal](https://phoenixnap.com/infrastructure-solutions/legal-it) - [MSPs & VARs](https://phoenixnap.com/infrastructure-solutions/it-partners) - [Media Hosting](https://phoenixnap.com/infrastructure-solutions/media-hosting) - [Online Gaming](https://phoenixnap.com/infrastructure-solutions/online-gaming) - [SaaS Hosting Solutions](https://phoenixnap.com/infrastructure-solutions/saas-hosting) - [Ecommerce Hosting Solutions](https://phoenixnap.com/infrastructure-solutions/ecommerce-hosting) COMPANY - [About phoenixNAP](https://phoenixnap.com/about) - [IaaS Solutions](https://phoenixnap.com/company/iaas-provider) - [Customer Experience](https://phoenixnap.com/company/customer-experience) - [Platform](https://phoenixnap.com/cloud-services/platform) - [Schedule Virtual Tour](https://phoenixnap.com/phoenix-data-center-virtual-tour) - [Open Source Community](https://phoenixnap.com/company/open-source-community) - [Resource Library](https://phoenixnap.com/company/resource-library) - [Press](https://phoenixnap.com/company/press) - [Events](https://phoenixnap.com/company/it-events) - [Careers](https://techjobs.dev/jobs/) - [Promotions](https://phoenixnap.com/promotions) - [Contact Us](https://phoenixnap.com/contact-us) - [Legal](https://phoenixnap.com/cs/legal/) - [Privacy Policy](https://phoenixnap.com/infrastructure-solutions/legal-it/eu-u-s-data-privacy-framework-program-eu-u-s-dpf-compliant-privacy-policy) - [Terms of Use](https://phoenixnap.com/cs/legal/aup.html) - [DMCA](https://phoenixnap.com/cs/legal/dmca.html) - [GDPR](https://phoenixnap.com/gdpr) - [Sitemap](https://phoenixnap.com/sitemap) - [Blog](https://phoenixnap.com/blog) - [Resources](https://phoenixnap.com/company/resource-library) - [Knowledge Base](https://phoenixnap.com/kb) - [IT Glossary](https://phoenixnap.com/glossary) - [GitHub](https://github.com/phoenixnap) - [RFP Template](https://phoenixnap.com/company/it-resources/data-center-rfp-template) Ā© 2025 phoenixNAP \| Global IT Services. All Rights Reserved.
Readable Markdown
[Home](https://phoenixnap.com/) Ā» [KB](https://phoenixnap.com/kb/) Ā» [SysAdmin](https://phoenixnap.com/kb/category/sysadmin) Ā» How to Kill a Process in Linux from Command Line? ![](https://secure.gravatar.com/avatar/8d4609e99e6aecc69ce049e18d45f033?s=200&d=mm&r=g) Topics: If a [Linux](https://phoenixnap.com/kb/what-is-linux) process becomes unresponsive or consumes excessive resources, killing it may be the only solution. Most processes have their own methods of shutting down. Unfortunately, processes can malfunction and require running a command to manually kill them. **This guide demonstrates how to kill a Linux process using the command line.** ![How to kill a process in Linux using the command line - a tutorial.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/how-to-kill-a-process-in-linux-from-command-line.png) Prerequisites A system running Linux. A user account with [root privileges](https://phoenixnap.com/glossary/what-is-root-access). Access to the terminal. How to Find Process ID or Process Name Before killing a process, you need to locate it. Processes can be found by the process name (or a partial process name) or the [process ID (PID)](https://phoenixnap.com/glossary/process-id). There are multiple ways to [find a process in Linux](https://phoenixnap.com/kb/list-processes-linux): Via the **`ps`** command. Via the **`pgrep`** or **`pidof`** command. Via the [top command](https://phoenixnap.com/kb/top-command-in-linux). The sections below show different ways to search for a process in Linux. Locate a Process with ps Command The **`ps`** command provides a complete listing of running processes, formatted based on the specified command options. The syntax for the **`ps`** command is: The most common options to add to **`ps`** are: **`-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](https://phoenixnap.com/glossary/what-is-a-daemon). For example, the command **`ps -aux`** returns a detailed list of all processes: ![The ps command output example on Linux.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/ps-command-output.png) Find PID with pgrep or pidof The **`pgrep`** Linux command is a more complex way of finding a process. The **`pgrep`** command returns processes based on specific selection criteria, known as the pattern. The pattern is a regular expression, such as **`a*`**, where **`*`** is a wildcard. The options that can be used with **`pgrep`** are: **`-l`**. List the process names and the PIDs. **`-n`**. Return the newest process. **`-o`**. Return the oldest process. **`-u`**. Only find processes that belong to a specific user. **`-x`**. Only find processes that exactly match the given pattern. For example, the command **`pgrep -l -u root`** displays the names and PIDs of all processes owned by root: ![Listing the running processes using the pgrep command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/pgrep-command-output.png) The **`pidof`** command is used to find the ID of a process using the process name. Some of the options that **`pidof`** accepts are: **`-c`**. Only return PIDs within a single [root directory](https://phoenixnap.com/glossary/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](https://phoenixnap.com/glossary/what-is-a-script). For example, to get the PID of the **`snapd`** process, run **`pidof snapd`**: ![Getting the process ID using the pidof command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/pidof-command-output.png) View Running Processes with top The top command is the easiest way to get a complete overview of the currently running processes. To view a list of all active processes, run the command: The **`top`** command interactive mode starts, shows the process IDs, the users, the amount of [memory](https://phoenixnap.com/glossary/physical-memory) and [CPU](https://phoenixnap.com/glossary/cpu-definition) power each process uses, the running time, etc. ![Listing running processes using the top command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/top-command-output.png) To exit the **`top`**interface, press **q**. How to Kill a Process Make sure to consider [permissions](https://phoenixnap.com/kb/linux-file-permissions) before killing or terminating a process. A root user can kill all processes. Either add [sudo](https://phoenixnap.com/kb/linux-sudo) before a command to run it as root, or obtain a root shell with the [su command](https://phoenixnap.com/kb/su-command-linux-examples). Then, execute the termination command. Killing a process sends a termination message to the given process. There are multiple types of termination messages, including: **`SIGKILL`** \- The ultimate way of killing a process. It always kills a process abruptly, generating a fatal error. **`SIGKILL`** should always work. If it doesn't, the [operating system](https://phoenixnap.com/glossary/operating-system) has failed. **`SIGTERM`** \- It attempts to kill a process, but, unlike **`SIGKILL`**, it may be blocked or otherwise handled. It is a gentler way of terminating a process. For most purposes, **`SIGKILL`** is the fastest and most effective method to terminate the process. The sections below list the most commonly used commands for killing a process and provide the steps for using each command. killall Command The **`killall`** command kills processes by their name. By default, it sends a **`SIGTERM`** signal. The **`killall`** command can kill multiple processes with a single command. The syntax is: The **`killall`** command accepts several options: **`-e`**. Find an exact match for the process name. **`-I`**. Ignore the 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. The following example shows the use of the **`-i`** option, instructing **`killall`** to ask for confirmation before terminating the process: ![Killing a process using the killall command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/kill-process-using-killall.png) In addition to killing processes based on name, the **`killall`** command can also be used to kill based on the age of the process. Use the following commands: **`-o`**. Use this flag with a duration to kill all processes that have been running for more than that amount of time. **`-y`**. Use this flag with a duration to kill all processes that have been running for less than that amount of time. The **`killall -o 15m`** command kills all processes that are older than 15 minutes, while the **`killall -y 15m`** command kills all processes that have been active for less than 15 minutes. pkill Command The **`pkill`** command is similar to the **`pgrep`** command, in that it kills a process based on the process name, in addition to other qualifying factors. By default, **`pkill`** sends the **`SIGTERM`** signal. The syntax is: **`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 owned by the specified user. **`-x`**. Only kill the processes that match the pattern exactly. **`-signal`**. Send a specific signal to the process, rather than **`SIGTERM`**. The following example demonstrates how to kill the newest process created by the user **`bosko`**: kill Command The **`kill`** command terminates processes via the process ID. The syntax is: The **`kill`** command kills a single process at a time with the given process ID. It sends a **`SIGTERM`** signal instructing a process to stop. It waits for the program to run its shutdown routine. The **`-signal`** option can be used to specify a signal other than **`SIGTERM`**. kill -9 Linux Command **`kill -9`** is used to shut down an unresponsive service. Run it similarly to the regular **`kill`** command: Or: The **`kill -9`** command sends a **`SIGKILL`** signal to a service, shutting it down immediately. An unresponsive program ignores a **`kill`** command, but it shuts down whenever a **`kill -9`** command is issued. Use this command with caution since it bypasses the standard shutdown routine, and any unsaved data will be lost. xkill command The **`xkill`** command is a special command that closes a given server's connection to clients. The syntax of the **`xkill`** command is: If a server has opened some unwanted processes, **`xkill`** aborts these processes. If **`xkill`** is run without specifying a resource, then an interface opens up to let the user select a window to close. For example: ![Killing processes using xkill in Linux.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/kill-process-using-xkill.png) top Command The **`top`** command provides an interface through which a user can navigate the currently running processes. To start the interface, run the command: To kill a specific process, press **`k`** when in the interface, and enter the PID of the process to terminate: ![Killing a process using the top command.](https://phoenixnap.com/kb/wp-content/uploads/2023/12/kill-process-using-top-command.png) **Note:** Learn how to use the [nohup command](https://phoenixnap.com/kb/linux-nohup) to block the **`SIGHUP`** signal and allow processes to complete even after logging out from the terminal/shell. Conclusion This guide explained several ways to kill processes in Linux. It is critical to learn and understand these **Linux termination commands** for [system management](https://phoenixnap.com/glossary/system-management) and administration. Next, check out our comprehensive article on [Linux network commands](https://phoenixnap.com/kb/linux-network-commands), or take a sneak peek at our [ultimate list of Linux commands](https://phoenixnap.com/kb/linux-commands). Was this article helpful? YesNo
Shard39 (laksa)
Root Hash8557101678125738839
Unparsed URLcom,phoenixnap!/kb/how-to-kill-a-process-in-linux s443