Results 1 to 9 of 9

Thread: Cannot kill program with command lines

  1. #1
    Join Date
    Aug 2013
    Beans
    2,325

    Cannot kill program with command lines

    Sometimes a program stops responding but I can't kill it on the the terminal with either killall foo or kill pid. But open the system monitor and click "kill process" always works. I am wondering what is the command used by system monitor.

  2. #2
    Join Date
    May 2007
    Location
    Midlands UK
    Beans
    292
    Distro
    Ubuntu

    Re: Cannot kill program with command lines

    Have you tried

    Code:
    pkill foo
    = Fit as a butcher's dog =

  3. #3
    Join Date
    Aug 2013
    Beans
    2,325

    Re: Cannot kill program with command lines

    No, will see if that works if this happens next time. Since it happens rarely I don't know when it will be.

  4. #4
    Join Date
    Dec 2005
    Location
    Western Australia
    Beans
    11,480
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Cannot kill program with command lines

    The default setting for 'kill' merely tells the program that it would be nice if it could please shut down. If the program is completely hung up, the normal kill won't do anything.

    There are different levels of kill but most of them rely on the program listening for the signal and reacting. The only sure-fire way to absolutely kill a program that is not responding is:

    kill -9 <pid>
    With the -9 option, kill actually tells the kernel to "end this program NOW", which always works. Obviously the program won't ask you if you want to save open documents, finish writing config files or complete a printing operation, so only use it when you have to.

  5. #5
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    9,008
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cannot kill program with command lines

    I think the default settings for the previous methods tried by the OP are -15, which is the Terminate signal. This works in most cases when the program is still running and not in a "crashed" state. "Terminate" is good to use because any open files get closed properly. -9 (Kill with prejudice) signal is effective, but you do run the risk of unfinished business.

    From the killall man page:

    DESCRIPTION
    killall sends a signal to all processes running any of the specified commands. If no signal name is specified, SIGTERM is sent.
    SIGTERM is flag -15, which is the polite termination flag.

    From the kill man page:

    DESCRIPTION
    The default signal for kill is TERM.
    TERM is another name for the polite termination signal (-15).

    To see the process flags available, try killing a process with htop:

    Code:
    sudo apt-get install htop
    Last edited by tgalati4; March 11th, 2014 at 03:23 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  6. #6
    Join Date
    Dec 2006
    Location
    USA
    Beans
    1,271
    Distro
    Ubuntu 15.04 Vivid Vervet

    Re: Cannot kill program with command lines

    Quote Originally Posted by monkeybrain20122 View Post
    Sometimes a program stops responding but I can't kill it on the the terminal with either killall foo or kill pid. But open the system monitor and click "kill process" always works. I am wondering what is the command used by system monitor.
    For that it's worth, I've always used:

    Code:
    xkill
    which turns the cursor into an "X", which, if you click on the misbehaving program, instantly shuts it down. It's never failed me, that I can remember.

  7. #7
    Join Date
    Nov 2010
    Location
    India
    Beans
    4,840
    Distro
    Ubuntu Development Release

    Re: Cannot kill program with command lines

    Quote Originally Posted by 3rdalbum View Post
    The default setting for 'kill' merely tells the program that it would be nice if it could please shut down. If the program is completely hung up, the normal kill won't do anything.

    There are different levels of kill but most of them rely on the program listening for the signal and reacting. The only sure-fire way to absolutely kill a program that is not responding is:



    With the -9 option, kill actually tells the kernel to "end this program NOW", which always works. Obviously the program won't ask you if you want to save open documents, finish writing config files or complete a printing operation, so only use it when you have to.

    +1 to kill -9
    Google First your issue , if no solution then ask.

    రాజ శేఖర్ రెడ్డి

  8. #8
    Join Date
    Aug 2013
    Beans
    2,325

    Re: Cannot kill program with command lines

    Thanks for all the reponses. I think I get the explanation now so I will mark this thread as solved.

  9. #9
    Join Date
    Sep 2008
    Location
    Chicago
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cannot kill program with command lines

    Quote Originally Posted by monkeybrain20122 View Post
    Sometimes a program stops responding but I can't kill it on the the terminal with either killall foo or kill pid. But open the system monitor and click "kill process" always works. I am wondering what is the command used by system monitor.
    One possible approach is to open a terminal (Ctrl-Alt-T) and enter
    Code:
    top
    Then find the pid (xyz) of the process you want to kill. Now, remaining in top, enter
    Code:
    k xyz
    Top always works for me. Of course, this isn't exactly the solution you were seeking.
    In working with *nix...There be dragons. Newcomers: I recommend reading Linux is Not Windows (http://linux.oneandoneis2.org/LNW.htm) and The Linux Command Line (http://www.linuxcommand.org/tlcl.php) before beginning your quest for a better OS.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •