0% found this document useful (0 votes)
37 views

Unix

The kill command can be used to terminate processes running on Linux and UNIX systems. To use kill, you first need to find the process ID (PID) of the target process using commands like ps or pidof. Then use the kill command along with the PID to terminate the process, such as kill 3486. For a more forceful termination, the -9 signal can be used like kill -9 3486. An alternative is to use the killall command which terminates a process by name instead of PID, though killall should be avoided on UNIX systems.

Uploaded by

anishj2
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Unix

The kill command can be used to terminate processes running on Linux and UNIX systems. To use kill, you first need to find the process ID (PID) of the target process using commands like ps or pidof. Then use the kill command along with the PID to terminate the process, such as kill 3486. For a more forceful termination, the -9 signal can be used like kill -9 3486. An alternative is to use the killall command which terminates a process by name instead of PID, though killall should be avoided on UNIX systems.

Uploaded by

anishj2
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Kill process using kill command under Linux/UNIX

kill command works under both Linux and UNIX/BSD like operating systems.

Step #1: First, you need to find out process PID (process id)
Use ps command or pidof command to find out process ID (PID). Syntax: ps aux | grep processname pidof processname For example if process name is lighttpd, you can use any one of the following command to obtain process ID: # ps aux | grep lighttpdOutput:
lighttpd 3486 0.0 0.1 4248 1432 ? S /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf lighttpd 3492 0.0 0.5 13752 3936 ? Ss /usr/bin/php5-cg Jul31 Jul31 0:00 0:00

OR use pidof command which is use to find the process ID of a running program: # pidof lighttpdOutput:
3486

Step #2: kill process using PID (process id)


Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:
# kill 3486

OR
# kill -9 3486

Where,

-9 is special Kill signal, which will kill the process.

killall command examples


DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):
# killall -9 lighttpd

Kill Firefox process:


# killall -9 firefox-bin

As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).

Some of the more commonly used signals:


signal # 1 2 3 6 9 14 15 Usage HUP (hang up) INT (interrupt) QUIT (quit) ABRT (abort) KILL (non-catchable, non-ignorable kill) ALRM (alarm clock) TERM (software termination signal)

You might also like