kill कमांड
kill एक runner के shoulder पर tap करके उसे nicely रुकने को कहने जैसा है। अगर वे नहीं सुनते, stronger version उन्हें track से सीधे yank कर देता है।
In this page:
Syntax
kill [-signal] process_id
kill
kill एक process को एक signal भेजता है, सबसे commonly SIGTERM (default) इसे gracefully terminate होने को कहने के लिए, या SIGKILL (kill -9) इसे immediately रुकने के लिए force करने के लिए।
आप एक process को इसके PID से target करते हैं। Scripts kill उपयोग करती हैं उन background jobs को रोकने के लिए जो उन्होंने शुरू की थीं, जैसे testing के लिए spin up किया एक server process।
Warning:
kill -9 (SIGKILL) को process catch या ignore नहीं कर सकता, इसलिए exit करने से पहले इसे clean up करने का कभी chance नहीं मिलता।उदाहरण: kill
#!/bin/bash
sleep 30 &
pid=$!
echo "Started process $pid"
kill "$pid"
echo "Sent termination signal to $pid"
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- पहले
kill -9उपयोग करना, जो process को clean up करने से रोकता है; पहले plainkilltry करें। - एक outdated value से गलत PID को kill करना।
- यह भूल जाना कि
killसिर्फ एक signal भेजता है, जिसे process handle या ignore कर सकता है।
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: