方法二
(1)查找进程ID
在linux里面可以先查找进程ID,可以使用pidof命令来查找。如查找java进程
pidof java 就可以返回进程号
如:
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ pidof java
3417
(2)杀死进程
kill -9 3417
这个也可以一次完成,也有两种方法
(1)
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ kill -9 $(pidof java)
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ ps -ef | grep tomcat
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ ps -ef | grep java
zhyiwww 3629 3491 0 10:19 pts/0 00:00:00 grep java
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$
(2)
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ ps -ef | grep java
zhyiwww 3647 1 3 10:19 pts/0 00:00:03 /usr/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/tools/green/apache-tomcat-6.0.18/conf/logging.properties -Djava.endorsed.dirs=/tools/green/apache-tomcat-6.0.18/endorsed -classpath :/tools/green/apache-tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/tools/green/apache-tomcat-6.0.18 -Dcatalina.home=/tools/green/apache-tomcat-6.0.18 -Djava.io.tmpdir=/tools/green/apache-tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ ps -ef | grep java
zhyiwww 3647 1 3 10:19 pts/0 00:00:03 /usr/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/tools/green/apache-tomcat-6.0.18/conf/logging.properties -Djava.endorsed.dirs=/tools/green/apache-tomcat-6.0.18/endorsed -classpath :/tools/green/apache-tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/tools/green/apache-tomcat-6.0.18 -Dcatalina.home=/tools/green/apache-tomcat-6.0.18 -Djava.io.tmpdir=/tools/green/apache-tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start
zhyiwww 3669 3491 0 10:21 pts/0 00:00:00 grep java
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ kill -9 `pidof java`
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$ ps -ef | grep java
zhyiwww 3672 3491 0 10:21 pts/0 00:00:00 grep java
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$
zhyiwww@debian:/tools/green/apache-tomcat-6.0.18$
|----------------------------------------------------------------------------------------|
版权声明 版权所有 @zhyiwww
引用请注明来源 http://www.blogjava.net/zhyiwww
|----------------------------------------------------------------------------------------|
posted on 2009-06-11 10:24
zhyiwww 阅读(1903)
评论(0) 编辑 收藏 所属分类:
linux