Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Ubuntu 查殺殭屍進程 (Zombie Process):ps 找出 PID/PPID → kill -HUP 父進程清理

編輯:關於 Linux

子進程結束而父進程未 wait() 回收會變成殭屍進程 (Z),佔用 PID 資源。本文教學:top 觀察 zombie 計數、ps -A -o stat,ppid,pid,cmd | grep -e '^[zZ]' 列出所有 Z 狀態進程及其父進程 PPID、kill -HUP PPID 發送 SIGHUP 通知父進程回收 (直接 kill -9 無效)。若父進程為 init (PID 1) 則由核心定期清理。

查殺流程

  1. top 確認 zombie 數量 > 0
  2. ps -A -o stat,ppid,pid,cmd | grep -e '^[zZ]' 取得 PID 與 PPID
  3. kill -HUP PPID 通知父進程處理

殭屍進程本身不佔 CPU/記憶體,但大量積累會耗盡 PID 導致無法建立新進程,定期清理是系統維運基本功。

Copyright © Windows教程網 All Rights Reserved