Shell in Linux (Bash, Zsh, Dash - features and differences)

Bash, Zsh, और Dash तीनों shells हैं जो same basic job करते हैं, पर Bash common default है (और इस course का shell), Zsh richer interactive features add करता है, और Dash छोटा-तेज़-POSIX-focused होता है scripts के लिए।

9 min read · 8 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

एक Job, कई Programs

पिछले topic ने shell को उस program की तरह introduce किया जो आपके commands पढ़ता है और kernel को इन्हें carry out करने कहता है। पर 'the shell' जैसी कोई एक चीज़ नहीं है; यह same job करने वाले कई अलग-अलग programs में से एक के लिए एक role है, बिल्कुल जैसे कई अलग-अलग text editors एक ही job करते हैं।

इस course में आप ज़्यादातर एक shell इस्तेमाल करेंगे, पर दूसरों के बारे में जानना आपको बताता है वे क्यों exist करते हैं और आप किसी और system पर shell prompt में कब कुछ अलग देखेंगे।

Theory

एक Shell क्या है, फिर से

याद कीजिए: shell वह command interpreter है जो आपके typed input को पढ़ता है, इसे समझता है, और kernel को appropriate action लेने कहता है। जो चीज़ shells को अलग करती है वह उनका core job नहीं है, यह उनका syntax, features, और performance है, interactive convenience और raw script-execution speed के बीच trade-offs।

At a glance

ShellFull NameCharacter और Typical Use
BashBourne Again SHellसबसे common default; feature-rich; interactive use और scripts दोनों के लिए standard (इस course का shell)
ZshZ ShellBash जैसा पर richer interactive features के साथ: better completion, themes, plugins
DashDebian Almquist SHellSmall, fast, minimal; strictly POSIX-only; system scripts जल्दी चलाने के लिए used, daily typing के लिए नहीं

Formula

Bash आपका Default है, और इस Course का Shell

सारे तीनों जानने लायक हैं, पर Bash वह shell है जिससे आप सबसे ज़्यादा deal करेंगे। यह Linux systems पर सबसे common default है, और यह वह shell है जो इस course में हम consistently इस्तेमाल करेंगे। जब भी हम आगे किसी 'the shell' का reference देते हैं बिना specify किए, यह Bash है जिसका हम मतलब रखते हैं।

Practical

मैं कौन सा Shell इस्तेमाल कर रहा हूँ?

echo $SHELL        # prints your login shell, e.g. /bin/bash

# The path names the shell program:
#   /bin/bash  -> Bash
#   /bin/zsh   -> Zsh
#   /bin/dash  -> Dash (often linked as /bin/sh)

Quiz

Scripts में performance और strict POSIX compliance के लिए अक्सर कौन सा shell चुना जाता है, और अक्सर /bin/sh की तरह इस्तेमाल होता है?

  1. Bash, क्योंकि यह सबसे बड़ा है
  2. Dash, Debian Almquist SHell, एक minimal fast shell जो scripts के लिए अक्सर /bin/sh की तरह इस्तेमाल होता है
  3. Zsh, क्योंकि इसमें सबसे ज़्यादा interactive features हैं
  4. कोई नहीं; सारे Linux shells identical हैं
Show the answer

Dash, Debian Almquist SHell, एक minimal fast shell जो scripts के लिए अक्सर /bin/sh की तरह इस्तेमाल होता है

Dash (Debian Almquist SHell) वह small, fast, minimal shell है जो scripts जल्दी चलाने के लिए built है; यह strictly POSIX पर टिका रहता है और जानबूझकर heavy interactive conveniences omit करता है, इसीलिए systems अक्सर इसे startup और system scripts के लिए /bin/sh की तरह इस्तेमाल करते हैं। Option A ग़लत है: Bash feature-rich है और everyday interactive default है, minimal script-runner नहीं। Option C description को उल्टा कर देता है: Zsh वह है जो interactive features (completion, themes, plugins) से loaded है, तो यह minimal choice नहीं है। Option D false है: shells core syntax share करते हैं पर size, speed, और features में genuinely अलग हैं। Tool को job से match कीजिए: daily use के लिए Bash, lean fast scripting के लिए Dash।

Think first

अगर वे Syntax Share करते हैं, तो कई Shells क्यों Exist करते हैं?

Bash, Zsh, और Dash सब similar commands accept करते हैं और same basic job करते हैं। अगर वे इतने alike हैं, अलग shells बनाने का point क्या है, बस एक universal shell क्यों नहीं? फिर tap कीजिए।

Show the answer

क्योंकि interactive convenience और raw execution speed अलग-अलग priorities हैं, और एक single shell दोनों को perfectly optimize नहीं कर सकता। Zsh interactive features पर heavy investment करता है, smart completion, themes, plugins, क्योंकि यह एक human के लिए हर दिन comfortably type करने को optimize करता है। Dash इसका बिल्कुल opposite करता है: यह इन सारे extras को strip कर देता है ताकि यह हज़ारों बार तेज़ी से boot और चल सके, script execution के लिए perfect जब कोई human देख नहीं रहा। Bash बीच में sits करता है, एक solid, widely-supported default जो दोनों worlds को reasonably अच्छी तरह handle करता है। अलग shells होने से आप right tool पिक कर सकते हैं: daily interactive work के लिए Zsh, lean fast scripts के लिए Dash, general-purpose reliability के लिए Bash। एक size हर किसी को fit नहीं करता जब आपकी goals genuinely tension में हैं।

Summary

Key takeaways

  • Bash, Zsh, और Dash तीनों shells हैं जो same core job करते हैं: command interpretation।
  • Bash (Bourne Again SHell) common default है और इस course का shell है।
  • Zsh (Z shell) richer interactive features देता है और macOS का default है।
  • Dash (Debian Almquist SHell) small, fast, strictly POSIX-focused है, अक्सर scripts के लिए /bin/sh।
  • echo $SHELL आपको बताता है आप currently कौन सा shell इस्तेमाल कर रहे हैं।
  • अलग shells exist करते हैं क्योंकि interactive convenience और script speed अलग trade-offs माँगते हैं।
  • Memory hook: Bash default, Zsh interactive-rich, Dash script-fast।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Introduction to Linux Operating System

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati