How to kill a proccess?

Discussion in 'Command Line' started by carbon333, Feb 16, 2012.

  1. carbon333

    carbon333 New Member

    Messages:
    87
    Likes Received:
    6
    Trophy Points:
    0
    You can do this by typing:

    killall name


    in the terminal. 'name' is the name of the procces to be killed.
  2. sbircris.jr

    sbircris.jr New Member

    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Or you can use # kill -9 process ID
    -9 is special kill signal, which will kill the process (Linux command, not UNX)
  3. enhu

    enhu New Member

    Messages:
    93
    Likes Received:
    4
    Trophy Points:
    0
    identify the process id by issuing #top command
    and then # kill -9 [processID]

    This is how i do it when mu computer hangs due to openshot. I just move to the terminal and then kill some running programs.
  4. Akendo

    Akendo New Member

    Messages:
    136
    Likes Received:
    7
    Trophy Points:
    0
    That's wrong. killall/kill will send a TERM signal to the program. This will ask the program to close itself. Kill is more a "signal singer", who is sending system signals to the programs. To "kill" a program you have to use the -9 option what is the real killer.

    You can use kill also to get a status of a program. For example dd. It will not print any status or progress till it's done. With kill -USR2 $DDPID you get a status out.

    HowTos are nice, but only when you explain what is happing. Details like this are important.

    so far
    4k3nd0
    Rob and goodselfme like this.
  5. goodselfme

    goodselfme New Member

    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    I will work this while I have this window open to follow these instructions well.thank you.
  6. carbon333

    carbon333 New Member

    Messages:
    87
    Likes Received:
    6
    Trophy Points:
    0
    But why even use "kill" instead of "killall" if you don't know the ID? Why check it first? killall was written so you don't have to to this!
  7. Akendo

    Akendo New Member

    Messages:
    136
    Likes Received:
    7
    Trophy Points:
    0
    pkill works with the name, like killall. But you should recognize the problem with killall/pkill. It's a system wide killer, this is a problem on multi-user system. When other users use the same tool/program and your killing it that way away.

    so far
    akendo
  8. EddyInBlu

    EddyInBlu New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Let's say you gotta kill the apache daemon?

    This is what I do

    ps aux | grep apache | cut -d ' ' -f 1 | xargs kill -9

    That'll do it

    Right?? XD
  9. KenJackson

    KenJackson Active Member

    Messages:
    129
    Likes Received:
    28
    Trophy Points:
    28
    How about these:
    Code:
    service httpd stop
    systemctl stop httpd.service
    rc.d stop httpd
    BTW, -9 is the same as -KILL. I had to run the command kill -l to find out what 9 is.
  10. Akendo

    Akendo New Member

    Messages:
    136
    Likes Received:
    7
    Trophy Points:
    0
    That's nice, but your about to lose a bit of the topic. Sure KenJackson, that is a "way" of doing it. But that's confusing, what system do you running on?
  11. KenJackson

    KenJackson Active Member

    Messages:
    129
    Likes Received:
    28
    Trophy Points:
    28
    The first one was the old way on Fedora (and I think Red Hat and CentOS, and probably PCLinuxOS and others), and it still works.

    The second one is the new way on those same systems, and probably on more.

    The third one is Arch (at least it should be right--I don't actually run an apache server on Arch).

    The point is that there is a more correct way to shutdown a server. Killing is always a last resort--even on a computer.
  12. lanlanlangzi

    lanlanlangzi New Member

    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    first ps,then kill /killall command
  13. DarthVader3257

    DarthVader3257 New Member

    Messages:
    45
    Likes Received:
    2
    Trophy Points:
    0
    I think killing a process should be quite similar to how it is done on Windows. Whatever opens up your Task Manager should include Processes, in which you can easily disable a process if needed.
  14. grim76

    grim76 Active Member Staff Writer

    Messages:
    177
    Likes Received:
    48
    Trophy Points:
    28
    Not everything is running a gui. I know the two servers that I run at home don't even have a gui installed.
  15. Renzaku

    Renzaku New Member

    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    This really is the only thing that I have to post. It's old, but it totally relates to this!

    Click Here
  16. Acronix

    Acronix New Member

    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Check the process list first by issuing the following command:

    Code:
    $ ps x
    Then look for the process identifier (PID) of the program you want to kill, then type:

    Code:
    $ kill -9 [PID]
    That's what they taught me ever since and that's what I always use.
    The -9 will ensure "execution" of your command.
  17. Godric

    Godric New Member

    Messages:
    35
    Likes Received:
    2
    Trophy Points:
    0
    Very helpful. Thanks. I suppose this is the dos version of windows?
  18. Acronix

    Acronix New Member

    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    No, it's for Linux terminal. You're welcome.
  19. Stefano Messicano

    Stefano Messicano New Member

    Messages:
    88
    Likes Received:
    3
    Trophy Points:
    0
    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. Step #2Above command tell you PID of lighttpd process. Now kill process using this PID.
  20. DaReaper

    DaReaper New Member

    Messages:
    184
    Likes Received:
    3
    Trophy Points:
    0
    I usually search for the process and it's PID before i attempt to kill or terminate it. Well i use grep to see if the process is running

    Code:
    ps aux | grep kloxo
    then find it's process id

    Code:
    pidof kloxo
    and kill it using

    kill pid

Share This Page