ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | FAIL | download_stamp > now() - 6 MONTH | 6.4 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://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/ |
| Last Crawled | 2025-10-03 00:12:24 (6 months ago) |
| First Indexed | 2016-11-23 03:38:39 (9 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Killing processes in UNIX - nixCraft |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | Q . Sometime I need to stop a command or task under UNIX. I also noticed that some process will ignore my keystroke-generated signals such as CTRL + C or CTRL+D, so my question is – How do I kill process in UNIX ? A. You need to use a command called kill. The kill utility sends a signal to the processes specified by the pid operand(s). Only the super-user (root) may send signals to other users’ processes. kill command syntax The kill command causes the specified signal to be sent to the specified process. The kill command has the general form as follows:
kill – N PID
Where, N is a signal number PID is the Process Identification Number. If you do not know the PID, it can be learned through the ps command. Understanding signal numbers The signal number 1 is a hangup signal. I recommended using 1 signal because it should kill the process and it can save the buffer (if supported). For example if it is an editor, save the buffer. This is the default if you do not specify a signal number. Signal number 9, a kill signal, is the surest way to kill a process. Some of the more commonly used signals: signal # Usage 1 HUP (hang up) 2 INT (interrupt) 3 QUIT (quit) 6 ABRT (abort) 9 KILL (non-catchable, non-ignorable kill) 14 ALRM (alarm clock) 15 TERM (software termination signal) How do I use kill command? Terminate the processes with pids 1412 and 1157: $ kill 1412 1157
Send the hangup signal (SIGHUP) to the process with pid 5071: # kill -s HUP 5071
Terminate the process group with pgid 12117: # kill -- -12117
If you do not know the PID of a process, you can learn it by issuing a process status command, ps. # ps | more
# ps | grep file.c
# ps | grep -i httpd
To send -9 (KILL) singal to the processo with pid 1234, enter: # kill -9 1234 🥺 Was this helpful? Please add a comment to show your appreciation or feedback . Vivek Gite is an expert IT Consultant with over 25 years of experience, specializing in Linux and open source solutions. He writes about Linux, macOS, Unix, IT, programming, infosec, and open source. Follow his work via RSS feed or email newsletter .
|
| Markdown | [](https://www.cyberciti.biz/faq/)
[nixCraft](https://www.cyberciti.biz/)
→
[Howto](https://www.cyberciti.biz/faq/)
→
[AIX](https://www.cyberciti.biz/faq/category/aix/)
→
Killing processes in UNIX
# [Killing processes in UNIX](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/)
Author: Vivek Gite Last updated: October 3, 2007 [8 comments](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comments)
[](https://www.cyberciti.biz/faq/category/unix/ "See all UNIX related articles/faq")
Q. Sometime I need to stop a command or task under UNIX. I also noticed that some process will ignore my keystroke-generated signals such as CTRL + C or CTRL+D, so my question is – **How do I kill process in UNIX**?
A. You need to use a command called kill. The kill utility sends a signal to the processes specified by the pid operand(s). Only the super-user (root) may send signals to other users’ processes.
## kill command syntax
The kill command causes the specified signal to be sent to the specified process. The kill command has the general form as follows:
kill –N PID
Where,
- **N** is a signal number
- **PID** is the Process Identification Number. If you do not know the PID, it can be learned through the ps command.
### Understanding signal numbers
The signal number 1 is a hangup signal. I recommended using 1 signal because it should kill the process and it can save the buffer (if supported). For example if it is an editor, save the buffer. This is the default if you do not specify a signal number. Signal number 9, a kill signal, is the surest way to kill a process.
### Some of the more commonly used signals:
| | |
|---|---|
| **signal \#** | **Usage** |
| 1 | HUP (hang up) |
| 2 | INT (interrupt) |
| 3 | QUIT (quit) |
| 6 | ABRT (abort) |
| 9 | KILL (non-catchable, non-ignorable kill) |
| 14 | ALRM (alarm clock) |
| 15 | TERM (software termination signal) |
## How do I use kill command?
Terminate the processes with pids 1412 and 1157:
`$ kill 1412 1157`
Send the hangup signal (SIGHUP) to the process with pid 5071:
`# kill -s HUP 5071`
Terminate the process group with pgid 12117:
`# kill -- -12117`
If you do not know the PID of a process, you can learn it by issuing a process status command, ps.
To send -9 (KILL) singal to the processo with pid 1234, enter:
`# kill -9 1234`
🥺 Was this helpful? Please add [a comment to show your appreciation or feedback](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#respond "Please add your comment below ↓ to show your appreciation or feedback to the author").
[Vivek Gite](https://www.vivekgite.com/) is an expert IT Consultant with over 25 years of experience, specializing in Linux and open source solutions. He writes about Linux, macOS, Unix, IT, programming, infosec, and open source. Follow his work via [RSS feed](https://www.cyberciti.com/atom/atom.xml "Get nixCraft updates using RSS feed") or [email newsletter](https://newsletter.cyberciti.com/subscription?f=1ojtmiv8892KQzyMsTF4YPr1pPSAhX2rq7Qfe5DiHMgXwKo892di4MTWyOdd976343rcNR6LhdG1f7k9H8929kMNMdWu3g "Get nixCraft updates using Email").
8 comments… [add one](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#respond)
- Rajendra Dec 4, 2009 @ 18:44
how to find PID?
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-45033) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-45033 "permalink to this comment")
- anilkumar Jul 28, 2011 @ 10:29
\# ps \| more
\# ps \| grep file.c
\# ps \| grep -i httpd
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-61090) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-61090 "permalink to this comment")
- hereis Dec 29, 2009 @ 2:08
use the command –top-
and if you want to kill a process
just hit “k” and then the “pid” of
the process and then input the signal
that’s ok.
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-45340) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-45340 "permalink to this comment")
- Anil Dewani May 15, 2010 @ 17:45
@Rajendra
you can use pidof command, example:
\# pidof openvpn
or you can even use ps command and fetch the PID from it, example:
\# ps \| grep openvpn \| awk ‘{print \$1}’\`
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-47347) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-47347 "permalink to this comment")
- Luciano Nov 10, 2011 @ 16:31
@Anil Dewani
U made my day with that hint: \# ps \| grep openvpn \| awk ‘{print \$1}’\`
I finally completed / fixed a script.
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-64312) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-64312 "permalink to this comment")
- Goutham Jan 4, 2012 @ 5:42
How to find the process id of a process which has already been killed in UNIX?
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-66335) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-66335 "permalink to this comment")
- yuvaraj.m Feb 2, 2012 @ 19:04
how do you find the process id (PID)?
One of the most common uses is to terminate hanging daemons.
For instance, you want to stop a daemon called LALALA. To find
out the PID of the LALALA, you execute the “ps -ef \| grep LALALA”
command from a shell terminal. The “ps -ef \| grep LALALA”
command lists all processes running in a full listing format, which
includes the process id. Then the command filters out the process
name in “grep LALALA”.
Example: ps -ef \| grep LALALA
Result:p
ID PID PPID C STIME TTY TIME CMD
LALALA 7209 32097 0 12:17 pts/87 00:00:00 ps -ef
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-67715) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-67715 "permalink to this comment")
- ramkumar Jul 19, 2014 @ 6:24
\$ps ax
[↩](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-227075) [∞](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#comment-227075 "permalink to this comment")
Leave a Reply[Cancel reply](https://www.cyberciti.biz/faq/howto-kill-unix-process-with-kill-command/#respond)
Use
HTML
\<pre\>...\</pre\> for code samples. Your comment will appear only after approval by the site admin.
Next FAQ: [FreeBSD send mail with attachments from command line / shell prompt](https://www.cyberciti.biz/faq/freebsd-command-line-mail-attach-with-mutt/)
Previous FAQ: [Linux taskset to retrieve or set a processess CPU affinity](https://www.cyberciti.biz/faq/taskset-cpu-affinity-command/)
🔥 FEATURED ARTICLES
- 1
[30 Cool Open Source Software I Discovered in 2013](https://www.cyberciti.biz/open-source/30-cool-best-open-source-softwares-of-2013/)
- 2
[30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X](https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html)
- 3
[Top 32 Nmap Command Examples For Linux Sys/Network Admins](https://www.cyberciti.biz/networking/nmap-command-examples-tutorials/)
- 4
[25 PHP Security Best Practices For Linux Sys Admins](https://www.cyberciti.biz/tips/php-security-best-practices-tutorial.html)
- 5
[30 Linux System Monitoring Tools Every SysAdmin Should Know](https://www.cyberciti.biz/tips/top-linux-monitoring-tools.html)
- 6
[40 Linux Server Hardening Security Tips](https://www.cyberciti.biz/tips/linux-security.html)
- 7
[Linux: 25 Iptables Netfilter Firewall Examples For New SysAdmins](https://www.cyberciti.biz/tips/linux-iptables-examples.html)
- 8
[Top 20 OpenSSH Server Best Security Practices](https://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html)
- 9
[Top 25 Nginx Web Server Best Security Practices](https://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html)
- 10
[My 10 UNIX Command Line Mistakes](https://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html)
👀 /etc
- ➔
[Linux shell scripting tutorial](https://bash.cyberciti.biz/guide/Main_Page "Linux Shell Scripting Tutorial Wiki")
- ➔
[RSS/Feed](https://www.cyberciti.com/atom/atom.xml "Get updates using RSS feed")
- ➔
[About nixCraft](https://www.cyberciti.biz/tips/about-us "About nixCraft")
©2002-2025 nixCraft • [Privacy](https://www.cyberciti.biz/tips/privacy "Privacy policy") • [ToS](https://www.cyberciti.biz/tips/disclaimer "Term of Service") • [Contact/Email](https://www.cyberciti.biz/tips/contact-us "Contact us via Email") • Corporate patron [Cloudflare](https://www.cyberciti.biz/tips/nixcraft-sponsors "Corporate patron") |
| Readable Markdown | null |
| Shard | 80 (laksa) |
| Root Hash | 1965753964674472280 |
| Unparsed URL | biz,cyberciti!www,/faq/howto-kill-unix-process-with-kill-command/ s443 |