Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Kill process by command name

  1. #1
    mop
    mop is offline Learning Programmer
    Join Date
    Apr 2008
    Posts
    30
    Rep Power
    0

    Kill process by command name

    I logged onto my server this morning and it was running incredibly slow. I had no idea wtf was causing the problem so I executed top and sorted by memory. I found this:

    Code:
     7298 customa  18   0  492M 492M  3768 S     0.0 12.3   0:08   1 java
     7300 customa  15   0  492M 492M  3768 S     0.0 12.3   1:58   2 java
     7301 customa  15   0  492M 492M  3768 S     0.0 12.3   1:58   7 java
     7302 customa  15   0  492M 492M  3768 S     0.0 12.3   1:58   5 java
     7303 customa  15   0  492M 492M  3768 S     0.0 12.3   1:58   1 java
     7304 customa  16   0  492M 492M  3768 S     0.0 12.3   1:57   6 java
     7305 customa  15   0  492M 492M  3768 S     0.0 12.3   1:58   3 java
     7306 customa  16   0  492M 492M  3768 S     0.0 12.3   1:58   4 java
     7307 customa  16   0  492M 492M  3768 S     0.0 12.3   1:58   3 java
     7308 customa  15   0  492M 492M  3768 S     0.0 12.3  15:59   5 java
     7309 customa  15   0  492M 492M  3768 S     0.0 12.3   0:07   4 java
     7310 customa  15   0  492M 492M  3768 S     0.0 12.3   0:10   6 java
     7311 customa  25   0  492M 492M  3768 S     0.0 12.3   0:00   4 java
     7312 customa  15   0  492M 492M  3768 S     0.0 12.3   0:00   3 java
     7313 customa  15   0  492M 492M  3768 S     0.0 12.3   0:32   7 java
     7314 customa  16   0  492M 492M  3768 S     0.0 12.3   0:38   6 java
     7315 customa  25   0  492M 492M  3768 S     0.0 12.3   0:00   4 java
     7316 customa  15   0  492M 492M  3768 S     0.0 12.3  11:11   0 java
     7320 customa  25   0  492M 492M  3768 S     0.0 12.3   0:00   0 java
     7578 customa  15   0  492M 492M  3768 S     0.0 12.3   1:00   4 java
     7585 customa  15   0  492M 492M  3768 S     0.0 12.3   2:19   5 java
     7586 customa  15   0  492M 492M  3768 S     0.0 12.3   2:11   1 java
     7587 customa  15   0  492M 492M  3768 S     0.0 12.3   2:21   3 java
     7588 customa  15   0  492M 492M  3768 S     0.0 12.3   2:16   3 java
     7589 customa  15   0  492M 492M  3768 S     0.0 12.3   2:10   2 java
     7590 customa  15   0  492M 492M  3768 S     0.0 12.3   2:13   6 java
     7591 customa  15   0  492M 492M  3768 S     0.0 12.3   2:12   4 java
     7592 customa  15   0  492M 492M  3768 S     0.0 12.3   2:13   0 java
     7593 customa  15   0  492M 492M  3768 S     0.0 12.3   2:19   0 java
     7594 customa  15   0  492M 492M  3768 S     0.0 12.3   2:14   4 java
     7595 customa  15   0  492M 492M  3768 S     0.0 12.3  49:32   5 java
     7599 customa  15   0  492M 492M  3768 S     0.0 12.3   1:03   3 java
     7603 customa  15   0  492M 492M  3768 S     0.0 12.3   1:00   4 java
     7608 customa  15   0  492M 492M  3768 S     0.0 12.3   0:00   2 java
    So, how can I killl all process that are executing Java?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    ToRk is offline Newbie
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Post

    Hello

    try
    killall -v java

  4. #3
    Tor
    Tor is offline Programming Expert
    Join Date
    Oct 2007
    Posts
    488
    Rep Power
    0
    When I look at the killall command I see: -v,--verbose report if the signal was successfully sent

    Not sure how killall -v java would help him in this case.

  5. #4
    ToRk is offline Newbie
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Post

    yes you are right , sorry for this mistake
    i recheck & almost nothing kill process by name

  6. #5
    Jordan Guest
    I don't think there is a default method to kill by name. You could write a shell script to do it though.

  7. #6
    Corwin's Avatar
    Corwin is offline Newbie
    Join Date
    Mar 2010
    Location
    Europe
    Posts
    12
    Rep Power
    0

    Re: Kill process by command name

    in additional you can try to kill with "-12" this will try to shutdown proper the application

  8. #7
    Join Date
    Jun 2010
    Location
    USA
    Posts
    579
    Blog Entries
    6
    Rep Power
    20

    Re: Kill process by command name

    I normally do 'ps aux' and 'kill -9' the PID

    Code:
    #ps aux
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    Last edited by Roger; 06-27-2010 at 07:17 PM.

  9. #8
    Join Date
    Jun 2010
    Location
    Vancouver, Eh.
    Posts
    4,020
    Blog Entries
    7
    Rep Power
    39

    Re: Kill process by command name

    Quote Originally Posted by dspin08 View Post
    I normally do 'ps aux' and 'kill -9' the PID
    A more apt and simple method, to kill all processes by the process' name:
    Code:
    killall -9  Java
    Note it will kill all open processes of the programme, if you would wish for it to be more specific:

    Code:
    killall -9 Java -u customa
    Be sure to read the updated FAQ || Health is achieved through 10,000 different steps.
    A textual description can be only part of your question, be sure to provide sample results, errors and your platform in the appropriate forums while asking.

  10. #9
    sea
    sea is offline Newbie
    Join Date
    Jul 2010
    Posts
    7
    Rep Power
    0

    Re: Kill process by command name

    This is already answered by the guy above me, but you should know about 'pkill', it kills a process by name. I think you can also use regexp in the name, too.
    Check the manpages for it.
    Code:
    example: pkill -9 java;

  11. #10
    phpforfun's Avatar
    phpforfun is offline Speaks fluent binary
    Join Date
    Feb 2008
    Posts
    1,232
    Blog Entries
    17
    Rep Power
    24

    Re: Kill process by command name

    kill -9 $(ps -e |grep "httpd" | awk '{print $1;}')

    or

    killall -9 httpd

    assuming httpd is the service you wanna kill.
    Checkout my new forum! http://adminreference.com/

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to kill a running process?VB 8
    By networkmancer in forum Visual Basic Programming
    Replies: 19
    Last Post: 09-21-2009, 12:23 PM
  2. Replies: 2
    Last Post: 05-07-2009, 01:17 AM
  3. Kill process not working
    By Victor in forum C# Programming
    Replies: 7
    Last Post: 04-13-2009, 06:11 PM
  4. does any1 know how to kill a process from a list in a text box?...
    By MXTECH in forum Visual Basic Programming
    Replies: 15
    Last Post: 07-17-2008, 03:00 AM
  5. kill process
    By ostudioo in forum C# Programming
    Replies: 9
    Last Post: 06-25-2008, 11:48 AM

Tags for this Thread

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