≡ Menu

kill command

OpenBSD: Reload / Restart / Stop dhcpd Server Command

I manage MS-Windows server and recently started to play with OpenBSD server. How do I reload or restart the dhcpd server on OpenBSD using shell command line option?
[click to continue…]

Linux: Start Command In Background

I am a new Linux command line user. How do I start or run command in the background so that I can access command prompt immediately?
[click to continue…]

Reload Squid Proxy Server Without Restarting Squid Daemon

I made some changes to the /etc/squid/squid.conf file and issued the command /sbin/service squid restart. However, this command takes way too much time to restart the server. How do I tell squid to just reread the config file and apply new changes under Linux operating systems?
[click to continue…]

UNIX / Linux: Kill All My Jobs Under Current Shell Session

How do I kill all the UNIX jobs I created under my current login shell such as Bash or KSH before logout?
[click to continue…]

OpenBSD Restart / Reload OpenSSH Without Rebooting

There is no rc.d script provided under OpenBSD for sshd service. How do I restart OpenSSH sshd server without rebooting OpenBSD 4.x server?
[click to continue…]

Linux / UNIX: Kill Command Examples

kill linux unix command

I'm a new Linux and Unix user. How do I send a KILL signal to a process under Linux or Unix-like operating systems using command prompt?
[click to continue…]

Q. I've made changes / updates to my /etc/inittab file to configure init process to start with agetty. init reads the /etc/inittab configuration file at the time of system boot. How do I re-read this file without rebooting my Linux server?
[click to continue…]

Killing processes in UNIX

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

  • 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

Kill Process in Linux or Terminate a Process in UNIX / Linux Systems

I am a new Linux system user. How do I kill process on Linux based server using command line options? How can I kill running process on Unix?
[click to continue…]