How do I kill Flash orphaned processes?
I'm using Ubuntu Linux 11.04. Periodically, I need to clean up orphaned Flash processes that resemble
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
0 R selenium 25949 1 54 80 0 - 19187 - 00:09 ? 05:26:03 /usr/lib/nspluginwrapper/i386/linux/npviewer.bin --plugin /usr/lib/flashplug
I know these are orphaned because the parent pid (PPID) will always be 1. Similarly I know the process is a开发者_高级运维lways an "npviewer.bin" process. I just don't know the magic one liner to identify all these processes and kill them.
Thanks for your help, - Dave
Try killall npviewer.bin
or killall -9 npviewer.bin
if you're feeling mean.
If you want to discriminate, you'll have to write a script that looks for this info in /proc, or maybe ps aux | grep npviewer | myscript
to string-hack the neccesary info.
Use ps -e -o "%P;%p;%c"
to locate the process. The output will be three columns, separated by ;
The first column must be 1 (PPID) and the last column contains the process name (without arguments). Some versions of ps add the path, some omit it. Trim the line (some versions of ps
pad the output) and look for the regexp npviewer.bin$
If a line matches, kill the process with the PID in column 2.
Thanks for the responses. The answer turns out to be
pgrep -P1 -f 'npviewer\.bin' | xargs kill -9
精彩评论