Find the answer to your Linux question:
Results 1 to 10 of 10
i want to find a running process call "iHackedYou.sh" and kill it. how do i do that? i tried: find iHackedYou.sh -exec kill '{}' \; but does not work...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    34

    how to find a process by name and kill it

    i want to find a running process call "iHackedYou.sh" and kill it. how do i do that? i tried:

    find iHackedYou.sh -exec kill '{}' \;

    but does not work

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Enter this at the command line
    Code:
    man killall
    and all will be revealed.

  3. #3
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Well, there are actually several ways to do this. The most straightforward would be using the "killall" command. The "kill" command takes a process ID, the "killall" command takes a process name.

    A second way would be to use either the "top" command or "ps aux" to see all running processes, find the PID that you want to end, and use "kill" to do so. This way, if you have two instances of Firefox running, you can end only the one you want to end.

    And the third way, and most complicated, would be to look at the numbered directories in /proc/. Each of these is a PID. Inside each of these directories is a "cmdline" file that tells the command run to get that PID. You could search these for the command you want, and kill the appropriate PIDs.

    It's a big world out there!
    DISTRO=Arch
    Registered Linux User #388732

  4. #4
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Code:
    pgrep string | xargs ps
    This will show any process that has string in its process name.

    Code:
    pkill string
    This will kill all processes that contain string anywhere in their process name. A little dangerous, cause you might kill processes you don't want to.

  5. #5
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,562
    Often Firefox will freeze when viewing Youtube videos. I have to xkill Firefox, but it will still be running, hindering me from restarting it. I find htop the best solution. Just open it, find the process and kill it as you would in regular top. The thing I like about htop is that you can easily move up and down through the processes stopping at the one you want and killing it with two key presses.
    Linux Mint + IceWM Registered:#371367 New Members: click here

  6. #6
    Just Joined!
    Join Date
    Oct 2007
    Posts
    1
    Not terribly elegant, I usually just use
    Code:
    kill -9 `pgrep string`

  7. #7
    Just Joined! boggy's Avatar
    Join Date
    Oct 2006
    Location
    Northeastern Pennsylvania
    Posts
    43
    ps aux : will also show you your processes and you can also you killall -9 pid#

  8. #8
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    Quote Originally Posted by likwid View Post
    A little dangerous, cause you might kill processes you don't want to.
    you can use -x option to get the exact process name...

  9. #9
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Smile

    Quote Originally Posted by Cabhan View Post
    And the third way, and most complicated, would be to look at the numbered directories in /proc/. Each of these is a PID. Inside each of these directories is a "cmdline" file that tells the command run to get that PID. You could search these for the command you want, and kill the appropriate PIDs.

    It's a big world out there!
    I never heard about this before ....every directory under proc is a directory of a process.
    thanks i'll explore those files
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  10. #10
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    I recommend pkill. Check out the -f option for more precision.

    man 1 pkill

Posting Permissions

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