LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   stop an executable file (https://www.linuxquestions.org/questions/linux-newbie-8/stop-an-executable-file-864480/)

makhlouf 02-23-2011 04:52 AM

stop an executable file
 
i run this command on file : chmod u+x recon (recon is the name of the file). then i run the file in question (. recon). i just want to stop it; how to do this ?

corp769 02-23-2011 04:57 AM

Code:

ps aux | grep recon
Run that, and you will get the PID of the process. Just do a "kill PID" and that's it. Good luck.

---------- Post added 02-23-11 at 11:57 AM ----------

Or if it doesn't run to background, CONTROL and C

tonyhawz 02-23-2011 05:03 AM

for example if you want to kill firefox
Code:

$ ps -ef | grep firefox
username    1033  1000  0 08:59 pts/1    00:00:00 grep firefox
username  31879 31875 28 08:34 ?        00:07:21 /usr/lib/firefox-3.6.13/firefox-bin

you get the pid number which is 31879
Code:

$ kill -9 31879
hope it helps

kernelzack 02-23-2011 09:21 PM

Kind of sloppy way to do this but it has never failed me

Say you wanted to kill firefox

kill `ps aux | grep firefox `

This will give you output saying "pid does not exist" etc etc, it runs the kill command on all output from previous command so ignore that. It will however kill the pid your targeting.

jmc1987 02-23-2011 11:26 PM

If it run in the terminal where you can't type you can try

<ctrl> + c

ntu929 02-24-2011 12:21 AM

u can also try ctrl+z in some situations:newbie:

frieza 02-24-2011 12:29 AM

killall -9 recon perhaps?

corp769 02-24-2011 11:41 AM

Quote:

Originally Posted by kernelzack (Post 4269180)
Kind of sloppy way to do this but it has never failed me

Say you wanted to kill firefox

kill `ps aux | grep firefox `

This will give you output saying "pid does not exist" etc etc, it runs the kill command on all output from previous command so ignore that. It will however kill the pid your targeting.

And that's where you pipe it into awk..... :)

One more way to do it.... You can just use pkill.

Code:

pkill firefox

unSpawn 02-24-2011 11:49 AM

Indeed using 'pkill' (also see 'pgrep' where people think 'ps|grep') is often faster and more efficient. Doesn't work in all cases though.

corp769 02-24-2011 12:14 PM

Quote:

Originally Posted by unSpawn (Post 4269873)
Indeed using 'pkill' (also see 'pgrep' where people think 'ps|grep') is often faster and more efficient. Doesn't work in all cases though.

That's why I said it's just one more way of doing it. There are many different ways....


All times are GMT -5. The time now is 01:55 AM.