Wednesday 18 September 2013

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

A list of common Term singles

Linux and Unix-like operating system supports the standard terminate signals listed below:
  1. SIGHUP (1) – Hangup detected on controlling terminal or death of controlling process. Use SIGHUP to reload configuration files and open/close log files.
  2. SIGKILL (9) – Kill signal. Use SIGKILL as a last resort to kill process. This will not save data or cleaning kill the process.
  3. SIGTERM (15) – Termination signal. This is the default and safest way to kill process.

What is a PID?

A Linux or Unix process is running instance of a program. For example, Firefox is a running process if you are browsing the Internet. Each time you start Firefox browser, the system is automatically assigned a unique process identification number (PID). A PID is automatically assigned to each process when it is created on the system. To find out PID of firefox or httpd process use the following command:
pidof httpd
pidof apache2
pidof firefox
OR use the combination of and grep command:
ps aux | grep httpd
ps aux | grep apache2
ps aux | grep  firefox

kill command syntax

The syntax is:
kill [signal] PID
kill -15 PID
kill -9 PID
kill -SIGTERM PID
kill [options] -SIGTERM PID

What Linux or Unix permissions do I need to kill a process?

Rules are simple:
  1. You can kill all your own process.
  2. Only root user can kill system level process.
  3. Only root user can kill process started by other users.

kill command examples

In this example, I am going to kill lighttpd server.

Step #1: Find out the PID (process id)

Use the ps or pidof command to find out PID for any program. For example, if process name is lighttpd, you can use any one of the following command to obtain process ID:
pidof lighttpd
Sample outputs:
3486

1 comment:

  1. Jadwal Daftar Sabung Ayam SV388 15 Februari 2019 di Situs Judi Sabung Ayam Online Melalui Agen Resmi Taruhan Sabung Ayam Live Asli Thailand.

    Jumat, Banten 15 Februari 2019 – Pada Hari Tersebut Akan Di Laksanakan Berbagai Pertandingan Sabung Ayam Secara Live di Arena Sabung Ayam Thailand.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete