ºìÁªLinuxÃÅ»§
Linux°ïÖú

ʹÓÃkillallÃüÁî

·¢²¼Ê±¼ä:2011-10-02 10:19:02À´Ô´:ºìÁª×÷Õß:empast
Õâ¸ö¹¤¾ß¿ÉÒÔ°´Ãû³ÆÖÕÖ¹Ò»¸ö½ø³Ì¡£ÀýÈ磬ϵͳÖÐÕýÓÐÒ»¸ö½ø³Ìsignal_demo.pl£¬Èç¹û¶ÁÕß²»Ï£Íû¼üÈëËüµÄPID£¬¾Í¿ÉÒÔÖÕÖ¹Ëü£¬¿ÉÒÔÔËÐÐÈçϵÄÃüÁ

killall -KILL signal_demo.pl

µ±Óû§²»ÌṩÐźÅÃû³Æʱ£¬killall»á×Ô¶¯·¢ËÍSIGTERMÐźš£ÔÚʹÓÃkillallÒª·Ç³£Ð¡ÐÄ£¬ÒòΪËüɱËÀ¸ÃÃüÁîÖ¸¶¨µÄËùÓÐʵÀý¡£²»Ç¡µ±µØʹÓôËÃüÁîÓÐʱ»áÒýÆðÒâÏë²»µ½µÄÂé·³¡£ÀýÈ磬ÓÐÏÂÁÐpsÊä³ö£º

PID TTY STAT TIME COMMAND
1246 p8 S 0:00 -tcsh
2160 p6 S 0:00 -tcsh
2365 p1 S 0:00 -bash
2459 p6 S 0:00 vi bar.txt
2460 p8 S 0:00 vi foo.txt
2463 p1 P 0:00 ps

Õâʱ£¬Èç¹ûÖÕÖ¹ÕýÓÃÓڱ༭foo.txtÎļþµÄvi½ø³Ì£¬ÔËÐÐkillall vi foo.txt£¬Æä½á¹û²»µ«ÊÇvi foo.txt½ø³Ì±»ÖÕÖ¹ÁË£¬¶øÇÒvi bar.txt½ø³ÌÒ²±»ÖÕÖ¹ÁË¡£ÕâÊÇÒòΪkillall°ÑÃû³Æ×÷ΪÃüÁîµÄ²ÎÊý£¬²¢ÇÒ°ÑÐźŴ«Ë͸øÖ¸¶¨½ø³ÌµÄËùÓÐʵÀý¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 4 ÌõÆÀÂÛ

  1. ouyangzq ÓÚ 2012-08-14 09:45:48·¢±í:

    be carefore to use killall?

  2. ËÕÎÄÁú ÓÚ 2012-07-26 14:47:10·¢±í:

    kill all . sounds very powerful ,but at the same time , it 's very harmful , right ?

  3. clorest510 ÓÚ 2012-01-06 09:35:12·¢±í:

    ѧϰÁË

  4. jm-kele ÓÚ 2011-12-19 16:22:06·¢±í:

    ѧϰÁË