Most popular web site - Processes with killallpkillis a bit aggressive, and if
Sunday, February 24th, 2008Processes with killallpkillis a bit aggressive, and if you re notcareful, it can kill processes that you don tintend to harm. If you want to kill a collectionof processes, exercise some caution and usekillallinstead. killallisn t as flexible as pkillwhen it comes toselecting processes, but it has one very nice feature: interactive mode. killallselects processes basedon program name. When you run killall, use the –interactiveoption (or -ifor short) to tell killallto prompt you before it kills each process: $ pgrep -lf more10512 more mozilla/run-mozilla.sh10513 more /etc/passwd$ killall –interactive moreKill more(10512) ? (y/n) yKill more(10513) ? (y/n) nLike pkill, killallsends SIGTERM by default. If you want to send a different signal, use the –signalsignal-nameoption: $ killall -i –signal SIGKILL moreKill more(10512) ? (y/n) yKill more(10513) ? (y/n) nClosing Windows with xkillOnce in a while, a window appears on your desktop, and you just don t know where it came from. It mightbe a pop-up ad from a piece of spyware, an annoyingmessage from a program running in the background, or just a program that forgot to identify itself. If youdon t know the name of the program that created thewindow, you can t kill it with kill, pkill, or killall. You need xkill, which kills off a program when youclick the program s window. To see xkillin action: sound confusing if you re not familiar with the bashcommand substitution feature, so it may help tobreak the command down a bit. Assume that thepgrepcommand returns three process IDs: $ pgrep -U freddie,franklin552378798256bash substitutes the output from pgrepinto the pscommand like this: $ ps -l –pid 5523 7879 8256You can feed the output from pgrepinto anyprogramthat expects a list of process IDs, such as kill. To killall processes owned by user freddie, you cancom- bine pgrepand killlike this: $ kill $(pgrep -U freddie) Killing Processes with pkillAn easy way to kill off unwanted processes is pkill. pkillis nearly identical to pgrep(in fact, you canselect processes using the same criteria in Table 39-3, which you can find earlier in this technique) exceptthat pkillkills the matching processes instead ofdisplaying matching process IDs. To kill all processesowned by user freddie, use the following command: $ pkill -U freddiepkill(and its cousin, kill) work by sending a signalto the targeted process. By default, pkillsends theSIGTERM signal to suggestthat the target process ter- minate itself. If you find a program that s not willingto honor SIGTERM, you can be more forceful byusing the -SIGKILLoption: $ pkill -SIGKILL -U freddieYou can send any signal with pkill. For a completelist of signals (and their meanings), see man 7 signal.
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.