Tuesday, February 20, 2024

Types of Shells in Linux like sh, csh, ksh, bash, tsh, zsh


SHELL is an interface between the user and an operating system. When the user logs in, Linux OS starts a shell for user then shell communicates with the kernel and interprets user commands. 
Kernel controls all essential computer operations, and provides the restriction to hardware access, coordinates all executing utilities, and manages Resources between process. Using kernel only user can access utilities provided by operating system. 

Types of Shell:-

1.) The Bourne Shell ( sh ) -
It was written by Steve Bourne at AT&T Bell Labs. It is the original UNIX shell. It is faster and more preferred by the Unix/Linux users.It is default shell for Solaris OS. It doesn't support advanced features like aliases, command history and built-in arithmetic expressions. 
In Bourne shell, Command full-path name is /bin/sh and /sbin/sh,
Non-root user default prompt is $,
Root user default prompt is #. 

2.) The C Shell (csh) was created by Bill Joy at the University of California at Berkeley. It incorporated features such as aliases and command history. It includes helpful programming features like built-in arithmetic and C-like expression syntax. 
In C shell, Command full-path name is /bin/csh,
Non-root user default prompt is hostname %,
Root user default prompt is hostname #. 

3.) The Korn Shell ( ksh ) -
It was written by David Korn at AT&T Bell Labs. It is a superset of the Bourne shell. So it supports everything in the Bourne shell.It has interactive features. It includes features like built-in arithmetic and C-like arrays, functions, and string-manipulation facilities. It is faster than C shell. It is compatible with script written for C shell.
In Korn shell, Command full-path name is /bin/ksh,
Non-root user default prompt is $,
Root user default prompt is #. 

4.) GNU Bourne-Again Shell ( bash ) -
It is compatible to the Bourne shell. It includes features from Korn and Bourne shell. 
In GNU Bourne-Again shell, Command full-path name is /bin/bash,
Default prompt for a non-root user is bash-g.gg$ 
(g.ggindicates the shell version number like bash-3.50$),
Root user default prompt is bash-g.gg#. 

T Shell – 
Denoted as tsh
It was originally developed for the Plan 9 operating system, but has since been ported to other systems, including Linux, FreeBSD, and macOS.
Command full-path name is /bin/tcsh,
Default prompt for a non-root user is abhishekaslk(user):~>
Root user default prompt is root@abhishekaslk(user):~#.

Z Shell –
Denoted by zsh
Z Shell (zsh) was created by Paul Falstad in 1990 while he was a student at Princeton University. Z Shell is an extended version of the Bourne-Again Shell (bash), with additional features and capabilities.
Command full-path name is /bin/zsh,
Default prompt for a non-root user is abhishekaslk(user)%
Root user default prompt is root@abhishekaslk(user):~#

Sunday, February 18, 2024

Difference Between Shell and Kernel शैल और कर्नेल के बीच अंतर

A shell is basically an interface present between the kernel and the user. A kernel is the very core of a typical OS.
शेल मूल रूप से कर्नेल और उपयोगकर्ता के बीच मौजूद एक इंटरफ़ेस है। कर्नेल एक विशिष्ट OS का मूल है। 

Meaning:- A shell is a CLI (command-line interpreter). A kernel is a type of low-level program that has its interfacing with the hardware on top of which all the applications run (disks, RAM, CPU, etc.).
अर्थ:- शेल एक सीएलआई (कमांड-लाइन दुभाषिया) है। कर्नेल एक प्रकार का निम्न-स्तरीय प्रोग्राम है जिसका इंटरफ़ेस हार्डवेयर के साथ होता है जिसके शीर्ष पर सभी एप्लिकेशन चलते हैं (डिस्क, रैम, सीपीयू, आदि)। 

Uses and Purpose:- A shell allows all of its users to establish communication with the kernel. A kernel functions to control all the tasks that come with a system.
उपयोग और उद्देश्य:- एक शेल अपने सभी उपयोगकर्ताओं को कर्नेल के साथ संचार स्थापित करने की अनुमति देता है। एक कर्नेल सिस्टम के साथ आने वाले सभी कार्यों को नियंत्रित करने का कार्य करता है। 

Types:-  Korn Shell, C Shell, Bourne Shell, etc., are types of shells.Hybrid kernel, Micro-kernel, Monolithic kernel, etc., are types of kernels.
प्रकार:- कॉर्न शेल, सी शेल, बॉर्न शेल आदि शेल के प्रकार हैं। हाइब्रिड कर्नेल, माइक्रो-कर्नेल, मोनोलिथिक कर्नेल आदि कर्नेल के प्रकार हैं। 

Functions:- We can use shell commands such as mkdir, ls, and many more for requesting the completion of the specific operation to the operating system (OS). A kernel carries out the commands on a group of various files by specifying the pattern that can match.
कार्य:- हम ऑपरेटिंग सिस्टम (ओएस) के लिए विशिष्ट ऑपरेशन को पूरा करने का अनुरोध करने के लिए शेल कमांड जैसे एमकेडीआईआर, एलएस और कई अन्य का उपयोग कर सकते हैं। एक कर्नेल विभिन्न फ़ाइलों के समूह पर उस पैटर्न को निर्दिष्ट करके कमांड निष्पादित करता है जो मेल खा सकता है। 

Management:- A shell performs memory management.A kernel performs process management.
प्रबंधन:- एक शेल मेमोरी प्रबंधन करता है। एक कर्नेल प्रक्रिया प्रबंधन करता है। 

Layer of OS:-The shell forms the outer layer of the operating system.The kernel forms the inner layer of the operating system.
ओएस की परत:-शेल ऑपरेटिंग सिस्टम की बाहरी परत बनाती है। कर्नेल ऑपरेटिंग सिस्टम की आंतरिक परत बनाती है। 

Machine-Understandability मशीन-समझने की क्षमता:- A shell interacts with all of its users and then interprets into a language that is understandable by the machine.A kernel interacts with the hardware directly because it accepts the machine-understandable language from the available shell.
एक शेल अपने सभी उपयोगकर्ताओं के साथ इंटरैक्ट करता है और फिर मशीन द्वारा समझने योग्य भाषा में व्याख्या करता है। एक कर्नेल सीधे हार्डवेयर के साथ इंटरैक्ट करता है क्योंकि यह उपलब्ध शेल से मशीन-समझने योग्य भाषा को स्वीकार करता है।