هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
kill PID sends SIGTERM (15): the program can save its data and exit. If it does not react, kill -9 PID (SIGKILL) makes the kernel end it at once — without cleanup. Other signals do other things: SIGHUP (1) makes many daemons re-read their config, SIGSTOP/SIGCONT pause and continue.
Users can only signal their own processes; root can signal all. In bash, kill is a built-in that also accepts job numbers like %1.
طريقة الكتابة
kill [-s SIGNAL | -SIGNAL] PID...
kill -l [NUMBER] | -Lالأجزاء الرئيسية
1HUP- Hang up; daemons often reload the config.
2INT- Interrupt (Ctrl+C).
3QUIT- Quit with a core dump.
9KILL- Kill now; cannot be caught.
15TERM- Terminate politely (default).
18CONT- Continue a paused process.
19STOP- Pause; cannot be caught.
20TSTP- Pause from the terminal (Ctrl+Z).
10USR1,12USR2- Program-specific (like reopen logs).
-1(PID)- All processes you may signal (dangerous).
-PGID- A negative PID = the whole process group.
الخيارات 8
الأكثر استخدامًا
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 11
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Stop a process politely
kill 4123SIGTERM: the program can clean up.
2Force it
kill -9 4123Only when SIGTERM did not work after some seconds.
3Reload a daemon's config
kill -HUP $(cat /run/sshd.pid)On RHEL
systemctl reload sshddoes the same.4List the signals
kill -lNames and numbers.
5Stop a background job
kill %2Job number from
jobs.6Pause and continue a process
kill -STOP 4123; kill -CONT 4123Pause a heavy job for a while.
7Polite, then hard after a timeout
/usr/bin/kill --timeout 5000 KILL -TERM 4123util-linux kill: SIGKILL if it still runs after 5 seconds.
8Stop a whole pipeline (process group)
kill -TERM -4120Negative number = process group.
9Contain a suspicious process (security)
Pause it, look at it, then decide; a killed process loses evidence in memory.
10Check if a process is still alive
kill -0 4123 && echo "running"Signal 0 sends nothing; it only tests.
11Make a service reopen its log files
kill -USR1 $(pidof nginx)nginx reopens logs on USR1 (log rotation).
لا يوجد شيء يطابق هذا الفلتر.
انتبه
kill -9can leave broken files, lock files and shared memory. Use it last.- Processes in state D (disk wait) do not die even with -9 until the I/O ends.
رموز الخروج
0 :: The signal was sent. 1 :: Error (no such process or not allowed).