ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.3 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://dzone.com/articles/how-to-kill-process-in-unixlinux |
| Last Crawled | 2026-03-29 04:12:30 (8 days ago) |
| First Indexed | 2021-01-13 03:06:41 (5 years ago) |
| HTTP Status Code | 200 |
| Meta Title | How to Kill Processes in Unix/Linux |
| Meta Description | There are different options to terminate a process in Unix/Linus flavor of operating systems. The kill command has many options to terminate processes. |
| Meta Canonical | null |
| Boilerpipe Text | Likes
(4)
Save
45.7K Views
Join the DZone community and get the full member experience.
Join For Free
There are different options to terminate a process in Unix/Linux flavor of operating systems. This article intends to list and provide examples of each option.
You can use the kill command to terminate a process by passing the process id. PID is the process ID of the process that you want to terminate.
If you want to kill a process whose PID is 1692 then the command would be:
Sometimes when you issue the kill command you may get an ‘operation not permitted’ error message. In those circumstances, issue the kill command with a ‘-9’ signal.
If you continue to get an ‘operation not permitted’ error message even with the ‘kill -9’ signal then you may not have sufficient permission to terminate the process. Then you need to ‘sudo’ as a ‘root’ user (i.e. login as a superuser) and then issue the ‘kill -9’ command.
Note:
This is the same as the ‘run as administrator’ option in Windows.
Fig:
Terminating the process with ‘kill -9’ signal
killall
killall command is another option to terminate multiple processes in one stroke. You can use this option to kill processes based on their names or by the users who launched them. Let’s explore all killall options in this section.
killall process_name
: Kill processes that match the specified process name. For example, refer to line 2 if you want to kill the process whose process name is ‘java.'
Fig: killall processname
Note:
If 3 processes are running with the name ‘java’, then when you use killall, all 3 processes will be terminated.
killall -I process_name
: Ignore case when trying to find the process name. If you want to kill the process whose process name is ‘java’, but if you are not sure about the case sensitivity of the process, then you can use ‘-l’ option. Refer to the example on line 2.
killall -i process_name
: Ask for additional confirmation when killing the process. If you want to kill the process whose process name is ‘java’ and the system requires confirmation, refer to the example on line 2.
Fig: Killall Confirmation
killall -u username:
Kills processes owned by a specific user. Line 1 demonstrates this. If you want to kill all the processes owned by the username ‘ec2-dev’, refer to the example on line 2.
killall -v process_name
: Report back on whether the process has been successfully killed.
Fig: Process Killed Reported
pkill
You can use the pkill command to terminate processes by sending a full name or partial name of the process. By default, pkill will send the signal SIGTERM. If you want to kill the process whose process name is ‘java’, refer to the example on line 2.
The Difference Between ‘killall’ and ‘pkill’
killall will look for the exact match of the process name whereas pkill will allow terminating the process either by full name or by partial process name.
Example: There is a process with the name ‘java’. If you try to terminate the process using ‘killall’ command by giving a partial name, i.e. ‘ava’, then you will get a ‘no process found’ error:
Fig. killall using partial process name
On the other hand if you try to terminate the process using the pkill command by giving a partial name, i.e., ‘ava’, it will succeed:
Fig. pkill using partial process name
top
You can also terminate a process using the popular system monitoring tool – top. Below are the steps to terminate a process in top:
Press the ‘k’ key when the top command is running
You will be prompted to enter the PID you want to terminate. Type the PID.
You will be prompted to enter which signal you want to use to kill the process. Type '9' which is a SIGKILL. By default, the signal will be SIGTERM ('15').
Press enter
Fig: killed using SIGKILL signal
Command (computing)
Java (programming language)
Opinions expressed by DZone contributors are their own. |
| Markdown | [](https://dzone.com/)
Thanks for visiting DZone today,
![user avatar]()
[Edit Profile](https://dzone.com/articles/how-to-kill-process-in-unixlinux)
- [Manage Email Subscriptions](https://dzone.com/articles/how-to-kill-process-in-unixlinux)
- [How to Post to DZone](https://dzone.com/articles/how-to-submit-a-post-to-dzone?utm_source=DZone&utm_medium=user_dropdown&utm_campaign=how_to_post)
- [Article Submission Guidelines](https://dzone.com/articles/dzones-article-submission-guidelines)
[Sign Out](https://dzone.com/users/logout.html) [View Profile](https://dzone.com/articles/how-to-kill-process-in-unixlinux)
Post
-  [Post an Article](https://dzone.com/content/article/post.html)
- [Manage My Drafts](https://dzone.com/articles/how-to-kill-process-in-unixlinux)
Over 2 million developers have joined DZone.
[Log In](https://dzone.com/users/login.html) / [Join](https://dzone.com/static/registration.html)
Search
Please enter at least three characters to search
[Refcards](https://dzone.com/refcardz) [Trend Reports](https://dzone.com/trendreports)
[Events](https://dzone.com/events) [Video Library](https://dzone.com/events/video-library)
[Refcards](https://dzone.com/refcardz)
[Trend Reports](https://dzone.com/trendreports)
Events
[View Events](https://dzone.com/events) [Video Library](https://dzone.com/events/video-library)
### Related
- [How to Modify Java Command-Line Arguments](https://dzone.com/articles/modifying-java-command-line-arguments)
- [JGit Library Examples in Java](https://dzone.com/articles/jgit-library-examples-in-java)
- [Quickly Find Your Java Application Process ID](https://dzone.com/articles/quickly-find-your-java-application-process-id)
- [Why High-Availability Java Systems Fail Quietly Before They Fail Loudly](https://dzone.com/articles/java-high-availability-failures)
### Trending
- [Where AI Fits and Fails in Workday Integrations](https://dzone.com/articles/where-ai-fits-and-fails-in-workday-integrations)
- [MCP Isn't Just Convenience; It's a Security Problem and a Governance Opportunity](https://dzone.com/articles/mcp-security-governance-opportunity)
- [The Messaging Challenges No One Talks About in Regulated, Air-Gapped, and Hybrid Environments](https://dzone.com/articles/messaging-challenges-regulated-hybrid)
- [Stop Debugging Code That Works: Identifying False Failures in Kubernetes](https://dzone.com/articles/stop-debugging-code-that-works-identifying-false-f)
1. [DZone](https://dzone.com/)
2. [Coding](https://dzone.com/coding)
3. [Java](https://dzone.com/java)
4. How to Kill Processes in Unix/Linux
# How to Kill Processes in Unix/Linux
### How to decide which kill command to use to best terminate a process
By

[Ram Lakshmanan](https://dzone.com/authors/vmoksha)
 CORE ·
Jan. 12, 21 · Tutorial
Likes (4)
Likes

There are no likes...yet! 👀
Be the first to like this post\!
It looks like you're not logged in.
[Sign in](https://dzone.com/users/login.html) to see who liked this post\!
Load More
Comment
Save
[Tweet](https://dzone.com/articles/how-to-kill-process-in-unixlinux)
[Share](https://www.linkedin.com/sharing/share-offsite/?url=https://dzone.com/articles/how-to-kill-process-in-unixlinux)
45\.7K Views
Join the DZone community and get the full member experience.
[Join For Free](https://dzone.com/static/registration.html)
There are different options to terminate a process in Unix/Linux flavor of operating systems. This article intends to list and provide examples of each option.
## kill
You can use the kill command to terminate a process by passing the process id. PID is the process ID of the process that you want to terminate.
Java
x
1
```
kill {PID}
```
If you want to kill a process whose PID is 1692 then the command would be:
Java
```
xxxxxxxxxx
```
1
1
```
kill 1692
```
Sometimes when you issue the kill command you may get an ‘operation not permitted’ error message. In those circumstances, issue the kill command with a ‘-9’ signal.
Java
```
xxxxxxxxxx
```
1
1
```
kill -9 {PID}
```
2
```
kill -9 1692
```
If you continue to get an ‘operation not permitted’ error message even with the ‘kill -9’ signal then you may not have sufficient permission to terminate the process. Then you need to ‘sudo’ as a ‘root’ user (i.e. login as a superuser) and then issue the ‘kill -9’ command.
**Note:** This is the same as the ‘run as administrator’ option in Windows.
![Terminating the process with ‘kill -9’ signal]()
*Fig:* *Terminating the process with ‘kill -9’ signal*
## killall
killall command is another option to terminate multiple processes in one stroke. You can use this option to kill processes based on their names or by the users who launched them. Let’s explore all killall options in this section.
- **killall process\_name**: Kill processes that match the specified process name. For example, refer to line 2 if you want to kill the process whose process name is ‘java.'
Java
```
xxxxxxxxxx
```
1
1
```
killall {ProcessName}
```
2
```
killall java
```
![killall processname]()
*Fig: killall processname*
**Note:** If 3 processes are running with the name ‘java’, then when you use killall, all 3 processes will be terminated.
- **killall -I process\_name**: Ignore case when trying to find the process name. If you want to kill the process whose process name is ‘java’, but if you are not sure about the case sensitivity of the process, then you can use ‘-l’ option. Refer to the example on line 2.
Java
```
xxxxxxxxxx
```
1
1
```
killall -I {ProcessName}
```
2
```
killall -I JAVA
```
- **killall -i process\_name**: Ask for additional confirmation when killing the process. If you want to kill the process whose process name is ‘java’ and the system requires confirmation, refer to the example on line 2.
Java
```
xxxxxxxxxx
```
1
1
```
killall -i {ProcessName}
```
2
```
killall -i java
```
![]()
*Fig: Killall Confirmation*
- **killall -u username:** Kills processes owned by a specific user. Line 1 demonstrates this. If you want to kill all the processes owned by the username ‘ec2-dev’, refer to the example on line 2.
Java
```
xxxxxxxxxx
```
1
1
```
killall -u {UserName}
```
2
```
killall -u ec2-dev
```
- **killall -v process\_name**: Report back on whether the process has been successfully killed.
Java
```
xxxxxxxxxx
```
1
1
```
killall -v {ProcessName}
```
2
```
killall -v java
```
![Process Killed Reported]()*Fig: Process Killed Reported*
## pkill
You can use the pkill command to terminate processes by sending a full name or partial name of the process. By default, pkill will send the signal SIGTERM. If you want to kill the process whose process name is ‘java’, refer to the example on line 2.
Java
```
xxxxxxxxxx
```
1
1
```
pkill {ProcessName}
```
2
```
pkill java
```
## The Difference Between ‘killall’ and ‘pkill’
killall will look for the exact match of the process name whereas pkill will allow terminating the process either by full name or by partial process name.
Example: There is a process with the name ‘java’. If you try to terminate the process using ‘killall’ command by giving a partial name, i.e. ‘ava’, then you will get a ‘no process found’ error:
![No process found error]()
*Fig. killall using partial process name*
On the other hand if you try to terminate the process using the pkill command by giving a partial name, i.e., ‘ava’, it will succeed:
![successful partial process name]()
*Fig. pkill using partial process name*
## top
You can also terminate a process using the popular system monitoring tool – top. Below are the steps to terminate a process in top:
1. Press the ‘k’ key when the top command is running
2. You will be prompted to enter the PID you want to terminate. Type the PID.
3. You will be prompted to enter which signal you want to use to kill the process. Type '9' which is a SIGKILL. By default, the signal will be SIGTERM ('15').
4. Press enter
![Killed the process which has the process\_id 11524 using the signal SIGKILL 9]()
*Fig: killed using SIGKILL signal*
Command (computing) Java (programming language)
Opinions expressed by DZone contributors are their own.
### Related
- How to Modify Java Command-Line Arguments
- JGit Library Examples in Java
- Quickly Find Your Java Application Process ID
- Why High-Availability Java Systems Fail Quietly Before They Fail Loudly
## Partner Resources
×
***
Comments
The likes didn't load as expected. Please refresh the page and try again.
ABOUT US
- [About DZone](https://dzone.com/pages/about)
- [Support and feedback](https://dzone.com/cdn-cgi/l/email-protection#91e2e4e1e1fee3e5d1f5ebfefff4bff2fefc)
- [Community research](https://dzone.com/pages/dzone-community-research)
ADVERTISE
- [Advertise with DZone](https://advertise.dzone.com/)
CONTRIBUTE ON DZONE
- [Article Submission Guidelines](https://dzone.com/articles/dzones-article-submission-guidelines)
- [Become a Contributor](https://dzone.com/pages/contribute)
- [Core Program](https://dzone.com/pages/core)
- [Visit the Writers' Zone](https://dzone.com/writers-zone)
LEGAL
- [Terms of Service](https://technologyadvice.com/terms-conditions/)
- [Privacy Policy](https://technologyadvice.com/privacy-policy/)
CONTACT US
- 3343 Perimeter Hill Drive
- Suite 215
- Nashville, TN 37211
- [\[email protected\]](https://dzone.com/cdn-cgi/l/email-protection#4f3c3a3f3f203d3b0f2b3520212a612c2022)
Let's be friends: |
| Readable Markdown | null |
| Shard | 102 (laksa) |
| Root Hash | 8443605588788139902 |
| Unparsed URL | com,dzone!/articles/how-to-kill-process-in-unixlinux s443 |