Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

How to kill a proccess?

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

  1. animaguy

    animaguy Guest

    thanks to all on this thread.

    Office Libre froze on me for the first time.

    I was working on a complex data base and as part of a reformatting technique, I copy and pasted a worksheet to another worksheet for backup and the whole thing froze.

    Eventually I was able to close and start all over again from where I last saved.

    If it happens again I will remember this thread and try some of the commands.
  2. Hector

    Hector Guest

    Interesting. I usually run skill $name.
  3. KenJackson

    KenJackson Guest

    I never heard of skill before. I was going to congratulate you on the find, but grief! Look how unflattering the man page is:

  4. Hector

    Hector Guest

    What can I say? It works fairly well for my needs. :p
  5. Bill

    Bill Guest

    If it is a graphical process, like Libreoffice, you can use xkill. After you type xkill in a terminal, you then just click on the program that you want to close. Works great for me and is much easier than trying to find the process ID.
  6. nixsavy

    nixsavy Guest

    You can also use fuser command to kill all processes. For example you want to kill apache2, find full running command with top as below

    #top -c
    Output will as

    1312 root      18   0 73516 2724 1252 S  0.0  0.3   0:00.02 /usr/sbin/apache2 -k start
     1313 www-data  18   0 73516 2048  564 S  0.0  0.2   0:00.00 /usr/sbin/apache2 -k start
    and run fuser with -k option and command as below

    #fuser -k /usr/sbin/apache2
    and all processes will kill and output will as below of this command.

    Means these process ids has been killed.
  7. ryanvade

    ryanvade Guest

  8. bashcommando

    bashcommando Guest

    kill `pidof <Process Name>`
  9. centos_fan

    centos_fan Guest

    ps and then kill is enough and most convenent if you don't care about data missing.
  10. bashcommando

    bashcommando Guest

    EXACTLY! What was that again?
  11. MikeyD

    MikeyD Guest

    It should be stressed that SIGKILL aka -9 aka -KILL should be used as a last resort!

    Kill can send a number of signals to a process to terminate. Sending a signal to the process first is usually a better option (as long as the program was well written and knows how to handle termination signals) as it lets the process clean itself up and potentially save progress before exiting. SIGKILL on the other hand doesn't send a signal to the process itself but to the kernel telling the kernel to immediately halt/kill/murder/destroy the given process. Sometimes this is the only option, but its generally not the cleanest.

    I generally run ps to get the PID (comptuers work with PIDs you should be doing the same)
    run kill $PID (sends SIGTERM signal by default if no flag is specified)

    If it is still not killed i'll then run kill -9 or kill -KILL to SIGKILL the process.
  12. Jefff

    Jefff Guest

    I know this is the command line section, but if you are on a desktop, you can always press CTRL-ESC
  13. jerz4lunch

    jerz4lunch Guest

    To kill the current shell process, type this in a shell.
    kill -9 $$
    $$ is a environment variable for the current shell's Process ID.

Share This Page