pgrep

प्रोसेस और सिस्टम

इस्तेमाल

pgrep [-f] <pattern>

पैटर्न से मेल खाने वाले सिर्फ़ PID छापता है, ठीक pkill जैसे ही नियमों से — यानी कुछ मारने से पहले का अभ्यास।

आम विकल्प

विकल्पअर्थ
-fMatch the full command line, so arguments count too.
-aPrint the command line next to the PID (Linux).
-lPrint the process name next to the PID.
-xExact name match only.
-u <user>Restrict to one user.
-cPrint how many matched instead of the PIDs.
-n / -oNewest / oldest match only.

उदाहरण

pgrep -af node

Every node process with its full command line.

pgrep -x sshd

The PID of sshd itself, not of anything merely mentioning ssh.

kill $(pgrep -f "celery worker")

Stop the processes the pattern found.

क्या चल रहा है और क्या मशीन खा रहा है। मारने से पहले पहचानना क्रम है।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. pgrep क्या करता है?

पैटर्न से मेल खाने वाले सिर्फ़ PID छापता है, ठीक pkill जैसे ही नियमों से — यानी कुछ मारने से पहले का अभ्यास।

Q. इसे कैसे लिखें?

pgrep [-f] <pattern> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 7 दिए हैं; पूरी सूची man pgrep में है। यह कमांड प्रोसेस और सिस्टम में आती है।

मिलती-जुलती कमांड

man पेज: man pgrep