Tech Junkie Blog - Real World Tutorials, Happy Coding!: Linux Process Management: The kill Command

Monday, March 7, 2022

Linux Process Management: The kill Command

 The kill command in Linux is a powerful command to kill a process. You usually see the kill command accompanied by the process ID however there's other ways you can use the kill command.  To get a list of how you can use the kill command, type kill -l

[root@cent7 jhuynh]# kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX    

There's one important thing that you have to remember as a standard user you can only kill are your own processes, so if you have two terminals open and one of them is not yours.  You can only kill the processes in your terminal or session.

Let's say you run the command ps to see the processes that are running, all you need to kill a process is type kill -9 PID

[root@cent7 jhuynh]# ps
  PID TTY          TIME CMD
 3526 pts/0    00:00:00 sudo
 3541 pts/0    00:00:00 su
 3544 pts/0    00:00:00 bash
 4787 pts/0    00:00:00 ps

So it's something like this kill -9 3544 to kill the bash process this will kill the terminal, alternatively you can type out the word that corresponds to -9 with the command kill -sigkill 3544



2 comments:

  1. Your , Post is very useful. Thank you this useful information.
    https://www.infosectrain.com/courses/certificate-cloud-security-knowledge-ccsk/

    ReplyDelete
  2. These command line are very useful to new era. In Linux, the kill command is a powerful command for eliminating a process. The kill command is commonly used in conjunction with the process ID, but it can also be used in other ways.
    https://www.buyessay.org.uk/business-essay-help/

    ReplyDelete

Search This Blog