linux中查看某进程 ps -ef | grep java(转)
ps-ef|grepjava查看所有关于java的进程
root17540102009?01:42:27/usr/java/jdk1.5.0_15/bin/java-Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties-server-Xms800m-Xmx800m-XX:PermSize=64M-XX:MaxNewSize=256m-XX:MaxPermSize=128m-Djava.awt.headless=true-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Xms256m-Xmx1024m-Djava.endorsed.dirs=/usr/local/tomcat/common/endorsed-classpath:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/commons-logging-api.jar-Dcatalina.base=/usr/local/tomcat-Dcatalina.home=/usr/local/tomcat-Djava.io.tmpdir=/usr/local/tomcat/temporg.apache.catalina.startup.Bootstrapstart
root1997910Jan05?00:00:51/usr/java/latest/bin/java-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.util.logging.config.file=/usr/local/apache-tomcat-6.0.16/conf/logging.properties-Xms256m-Xmx1024m-Djava.endorsed.dirs=/usr/local/apache-tomcat-6.0.16/endorsed-classpath:/usr/local/apache-tomcat-6.0.16/bin/bootstrap.jar-Dcatalina.base=/usr/local/apache-tomcat-6.0.16-Dcatalina.home=/usr/local/apache-tomcat-6.0.16-Djava.io.tmpdir=/usr/local/apache-tomcat-6.0.16/temporg.apache.catalina.startup.Bootstrapstart
root2712027015013:23pts/400:00:00grepjava
通过ps-ef|grepjava得到如上线程将某线程终止时用
kill-9XXXXXXXXXX为上述查出的序号如:19979线程终止为:kill-919979
kill一个线程时需注意不要误停止了不应该停止的线程造成不必要的麻烦。
在相当确信时才可用此方法停止线程。