which

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

इस्तेमाल

which [-a] <name>

PATH में खोजकर बताता है कि उस नाम का executable कहाँ है; चूँकि यह केवल PATH देखता है, alias, function और shell builtin के बारे में झूठ बोलता है — सच्चा उत्तर `type -a` या `command -v` देता है।

आम विकल्प

विकल्पअर्थ
-aShow every match in PATH, not just the first one.
<name> <name>Several names at once; the exit status is nonzero if any is missing.
-sPrint nothing, just set the exit status (BSD/macOS).

उदाहरण

which -a python3

Spot a second python3 earlier in PATH than the one you expected.

command -v node || echo missing

The portable check to use in scripts.

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

कैसे पढ़ें

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

आम सवाल

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

PATH में खोजकर बताता है कि उस नाम का executable कहाँ है; चूँकि यह केवल PATH देखता है, alias, function और shell builtin के बारे में झूठ बोलता है — सच्चा उत्तर `type -a` या `command -v` देता है।

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

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

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

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

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

man पेज: man which