Sunday, March 10, 2024

Startup and Shutdown process in Linux system लिनक्स सिस्टम में स्टार्टअप एवं शट्डाउन प्रक्रिया

In Linux, starting up and shutting down the system can be done using various commands. Here are the basic commands for startup and shutdown:-
लिनक्स में, सिस्टम को शुरू करना और बंद करना विभिन्न कमांड का उपयोग करके किया जा सकता है। यहां स्टार्टअप और शटडाउन के लिए बेसिक कमांड्स दिए गए हैं:-

Startup Process:-

1. Simply turning on your computer initiates the startup process.after that 
अपने कंप्यूटर को चालू करने से स्टार्टअप प्रक्रिया शुरू हो जाती है। इसके पश्चात 

2. Grand Unified Bootloader or another boot loader loads the Linux kernel.
ग्रैंड यूनिफाइड बूटलोडर या अन्य बूट लोडर लिनक्स कर्नेल को लोड करता है। 

3. The Linux kernel initializes essential system components and starts the init process.
लिनक्स कर्नेल आवश्यक सिस्टम घटकों को आरंभ करता है और init प्रक्रिया शुरू करता है। 

4. The init process or systemd is responsible for bringing up the system services and processes based on the runlevel or target.
अब init प्रक्रिया या systemd रन लेवल या लक्ष्य के आधार पर सिस्टम सेवाओं और प्रक्रियाओं को प्रदर्शित करने के लिए जिम्मेदार होते है।

Shutdown Process:-

1. Open a terminal and type command 
टर्मिनल को ओपन करे एवं निम्न कमांड टाइप करें 

sudo shutdown -h now

This command shuts down the system immediately.
यह कमांड सिस्टम को तुरंत शट डाउन कर देती है।

2. To reboot the system immediately, use command 
सिस्टम को पुनः प्रारंभ करने हेतु यह कमांड प्रयुक्त करे

sudo reboot

3. We can schedule a shutdown at a specific time,use command
हम सिस्टम को निश्चित समयानुसार भी पुनः प्रारंभ कर सकते है इस हेतु यह कमांड प्रयुक्त करे

sudo shutdown -h HH:MM

Replace HH:MM with the desired time.
यहां HH:MM को निश्चित समय से बदल लेवे।

4. If a scheduled shutdown has been initiated and we want to cancel it then type 
यदि सिस्टम को निश्चित समयानुसार पुनः प्रारंभ होने की स्थिति में सेट किया गया हैं एवं हम इसे रोकना चाहते है तब यह कमांड प्रयुक्त करे

sudo shutdown -c 

5. On systems using systemd, you can use `systemctl` for more control:
वे सिस्टम जो systemd का प्रयोग करते है निम्न systemctl कंट्रोल कमांड का प्रयोग करते है

sudo systemctl poweroff   # Shut down
sudo systemctl reboot     # Reboot

    

Hard Disc partitioning for Linux installation लिनक्स इनस्टॉल करने के लिए हार्ड डिस्क का विभाजन

When partitioning your disk for Linux, it typically involves creating at least two partitions:-
लिनक्स के लिए अपनी डिस्क को विभाजित करते समय, इसमें आम तौर पर कम से कम दो विभाजन बनाना शामिल होता है: - 
1. Root Partition ("/"):- Allocate a reasonable amount for the root partition; 20-30 GB is often sufficient, depending on your needs. Ext4 is a common choice for the root partition.
रूट विभाजन ("/"):- रूट विभाजन के लिए उचित राशि आवंटित करें; आपकी ज़रूरतों के आधार पर, 20-30 जीबी अक्सर पर्याप्त होता है। रूट विभाजन के लिए Ext4 एक सामान्य विकल्प है। 

2. Swap Partition:- Traditionally, the swap space is recommended to be at least equal to your RAM size, but it can vary. For systems with ample RAM (8GB or more), a swap partition of 4-8 GB is often sufficient. Swap doesn't use a typical file system.
स्वैप विभाजन: - परंपरागत रूप से, स्वैप स्थान को कम से कम आपके रैम आकार के बराबर रखने की सिफारिश की जाती है, लेकिन यह भिन्न हो सकता है। पर्याप्त रैम (8 जीबी या अधिक) वाले सिस्टम के लिए, 4-8 जीबी का स्वैप विभाजन अक्सर पर्याप्त होता है। स्वैप एक सामान्य फ़ाइल सिस्टम का उपयोग नहीं करता है।

Optionally, we may also create a separate partition for "/home" to keep user data separate from the system files:-
वैकल्पिक रूप से, हम उपयोगकर्ता डेटा को सिस्टम फ़ाइलों से अलग रखने के लिए "/ होम" के लिए एक अलग विभाजन भी बना सकते हैं: - 

3. Home Partition ("/home"):- This partition holds user data, so allocate space based on your storage needs. If you have a separate data partition, you can keep "/home" smaller. Ext4 is common, just like the root partition.
होम पार्टीशन ("/होम"):- यह पार्टीशन उपयोगकर्ता डेटा रखता है, इसलिए अपनी भंडारण आवश्यकताओं के आधार पर स्थान आवंटित करें। यदि आपके पास एक अलग डेटा विभाजन है, तो आप "/home" को छोटा रख सकते हैं। Ext4 सामान्य है, बिल्कुल रूट विभाजन की तरह।

Installation process of Linux (Ubuntu) by using Bootable USB बूट करने योग्य यूएसबी का उपयोग करके उबंटू (लिनक्स) स्थापित करने हेतु सामान्य चरण

To install Ubuntu (Linux) using a bootable USB, follow these general steps:-
बूट करने योग्य यूएसबी का उपयोग करके उबंटू (लिनक्स) स्थापित करने के लिए, इन सामान्य चरणों का पालन करें: -

1. Download the Ubuntu ISO file from the official website (https://ubuntu.com/download).
आधिकारिक वेबसाइट (https://ubuntu.com/download) से उबंटू आईएसओ फ़ाइल डाउनलोड करें।

2. Create a Bootable USB by Using a tool like Rufus (Windows) or balenaEtcher (Windows/Mac/Linux).
Rufus (Windows) या balenaEtcher (Windows/Mac/Linux) जैसे टूल का उपयोग करके एक बूटेबल USB बनाएं। 

3. Insert the bootable USB into your computer and restart. Access the boot menu (usually by pressing a key like F2, F12, or Esc during startup) and choose the USB drive as the boot device.
बूट करने योग्य यूएसबी को अपने कंप्यूटर में डालें और पुनरारंभ करें। बूट मेनू तक पहुंचें (आमतौर पर स्टार्टअप के दौरान F2, F12, या Esc जैसी कुंजी दबाकर) और बूट डिवाइस के रूप में USB ड्राइव चुनें। 

4. Once booted from the USB, choose "Try Ubuntu" to run a live session. This allows you to explore Ubuntu without installing it.
एक बार यूएसबी से बूट होने के बाद, लाइव सत्र चलाने के लिए "उबंटू आज़माएं" चुनें। यह आपको उबंटू को इंस्टॉल किए बिना एक्सप्लोर करने की अनुमति देता है। 

5. On the desktop, you'll find an icon to install Ubuntu. Double-click it to launch the installer.
डेस्कटॉप पर, आपको उबंटू इंस्टॉल करने के लिए एक आइकन मिलेगा। इंस्टॉलर लॉन्च करने के लिए इसे डबल-क्लिक करें।

6. Follow installation wizard and either choose to install Ubuntu alongside your existing operating system or choose to erase the disk and install Ubuntu.
इंस्टॉलेशन विज़ार्ड का पालन करें और या तो अपने मौजूदा ऑपरेटिंग सिस्टम के साथ उबंटू इंस्टॉल करना चुनें या डिस्क को मिटाकर उबंटू इंस्टॉल करना चुनें। 

7. Enter your details, including username and password to create user account.
उपयोगकर्ता खाता बनाने के लिए उपयोगकर्ता नाम और पासवर्ड सहित अपना विवरण दर्ज करें।

8. The installer will copy files and install Ubuntu. Once finished, it will prompt you to remove the installation media and press Enter.
इंस्टॉलर फाइलों को कॉपी करेगा और उबंटू इंस्टॉल करेगा। एक बार समाप्त होने पर, यह आपको इंस्टॉलेशन मीडिया को हटाने और एंटर दबाने के लिए संकेत देगा। 

Now Restart your computer and Login to Ubuntu, ensuring that it boots from the hard drive now.
अब अपने कंप्यूटर को पुनरारंभ करें और उबंटू में लॉग इन करें, यह सुनिश्चित करें कि यह अब हार्ड ड्राइव से बूट हो।

Friday, March 8, 2024

Linux Boot block, Super block, inode table and data blocks.

In Linux file systems, the boot block is the initial sector on a storage device, containing the bootloader. The superblock stores metadata about the file system, including its size and status. The inode table holds information about files and directories, while data blocks store actual file content. These components work together to manage file system structure and data organization.
लिनक्स फ़ाइल सिस्टम में, बूट ब्लॉक स्टोरेज डिवाइस पर प्रारंभिक सेक्टर होता है, जिसमें बूटलोडर होता है। सुपरब्लॉक फ़ाइल सिस्टम के बारे में मेटाडेटा संग्रहीत करता है, जिसमें उसका आकार और स्थिति भी शामिल है। इनोड तालिका फ़ाइलों और निर्देशिकाओं के बारे में जानकारी रखती है, जबकि डेटा ब्लॉक वास्तविक फ़ाइल सामग्री को संग्रहीत करता है। ये घटक फ़ाइल सिस्टम संरचना और डेटा संगठन को प्रबंधित करने के लिए एक साथ काम करते हैं। 

1.) The boot block is crucial for initializing the boot process, often containing the bootloader code necessary for loading the operating system. The boot block is the initial sector on a storage device, typically the first 512 bytes, and it plays a crucial role in the boot process of an operating system. It contains the bootloader, a small program responsible for loading the operating system into memory. The boot block is essential for initiating the system startup sequence and transitioning control to the kernel, allowing the operating system to take over and start executing.
1.) बूट प्रक्रिया को आरंभ करने के लिए बूट ब्लॉक महत्वपूर्ण है, जिसमें अक्सर ऑपरेटिंग सिस्टम को लोड करने के लिए आवश्यक बूटलोडर कोड होता है। बूट ब्लॉक एक स्टोरेज डिवाइस पर प्रारंभिक सेक्टर है, आमतौर पर पहले 512 बाइट्स, और यह एक ऑपरेटिंग सिस्टम की बूट प्रक्रिया में महत्वपूर्ण भूमिका निभाता है। इसमें बूटलोडर शामिल है, एक छोटा प्रोग्राम जो ऑपरेटिंग सिस्टम को मेमोरी में लोड करने के लिए जिम्मेदार है। बूट ब्लॉक सिस्टम स्टार्टअप अनुक्रम शुरू करने और नियंत्रण को कर्नेल में स्थानांतरित करने के लिए आवश्यक है, जिससे ऑपरेटिंग सिस्टम को कार्यभार संभालने और निष्पादन शुरू करने की अनुमति मिलती है। 

2.)The super block serves as a central repository of metadata, storing details like the file system type, size, status, and information about free blocks.The super block is a critical data structure in a file system, holding metadata about the file system itself. It includes information such as the file system type, size, status, block size, and pointers to other important data structures like the inode table. The superblock is typically located at a fixed position within the file system and is crucial for the operating system to understand and manage the file system during the mounting process. It serves as a central repository for essential details about the file system's layout and configuration.
2.) सुपर ब्लॉक मेटाडेटा के केंद्रीय भंडार के रूप में कार्य करता है, फ़ाइल सिस्टम प्रकार, आकार, स्थिति और मुक्त ब्लॉक के बारे में जानकारी जैसे विवरण संग्रहीत करता है। सुपर ब्लॉक फ़ाइल सिस्टम में एक महत्वपूर्ण डेटा संरचना है, जो फ़ाइल के बारे में मेटाडेटा रखता है सिस्टम ही. इसमें फ़ाइल सिस्टम प्रकार, आकार, स्थिति, ब्लॉक आकार और इनोड तालिका जैसी अन्य महत्वपूर्ण डेटा संरचनाओं के संकेतक जैसी जानकारी शामिल है। सुपरब्लॉक आम तौर पर फ़ाइल सिस्टम के भीतर एक निश्चित स्थान पर स्थित होता है और माउंटिंग प्रक्रिया के दौरान फ़ाइल सिस्टम को समझने और प्रबंधित करने के लिए ऑपरेटिंग सिस्टम के लिए महत्वपूर्ण है। यह फ़ाइल सिस्टम के लेआउट और कॉन्फ़िगरेशन के बारे में आवश्यक विवरणों के लिए एक केंद्रीय भंडार के रूप में कार्य करता है।

3.) The **inode table** is a data structure that stores information about each file or directory, excluding the actual data content. It includes details like file permissions, ownership, size, and pointers to data blocks.The **inode table** is a data structure in a file system that stores information about files and directories. Each file or directory in the file system is represented by an inode (index node), and the inode table keeps track of these inodes. For each inode, the table contains details such as file permissions, ownership, size, timestamps, and pointers to the data blocks where the actual file content is stored. The inode table essentially serves as a lookup table, enabling the operating system to quickly access and manage information about files and directories in the file system without having to search through the entire storage medium.
3.) **इनोड तालिका** एक डेटा संरचना है जो वास्तविक डेटा सामग्री को छोड़कर, प्रत्येक फ़ाइल या निर्देशिका के बारे में जानकारी संग्रहीत करती है। इसमें फ़ाइल अनुमतियाँ, स्वामित्व, आकार और डेटा ब्लॉक के संकेतक जैसे विवरण शामिल हैं। **इनोड तालिका** फ़ाइल सिस्टम में एक डेटा संरचना है जो फ़ाइलों और निर्देशिकाओं के बारे में जानकारी संग्रहीत करती है। फ़ाइल सिस्टम में प्रत्येक फ़ाइल या निर्देशिका को एक इनोड (इंडेक्स नोड) द्वारा दर्शाया जाता है, और इनोड तालिका इन इनोड का ट्रैक रखती है। प्रत्येक इनोड के लिए, तालिका में फ़ाइल अनुमतियाँ, स्वामित्व, आकार, टाइमस्टैम्प और डेटा ब्लॉक के पॉइंटर्स जैसे विवरण शामिल होते हैं जहां वास्तविक फ़ाइल सामग्री संग्रहीत होती है। इनोड तालिका अनिवार्य रूप से एक लुकअप तालिका के रूप में कार्य करती है, जो ऑपरेटिंग सिस्टम को संपूर्ण स्टोरेज माध्यम में खोज किए बिना फ़ाइल सिस्टम में फ़ाइलों और निर्देशिकाओं के बारे में जानकारी तक त्वरित रूप से पहुंचने और प्रबंधित करने में सक्षम बनाती है। 

4.) Data blocks are where the actual content of files and directories is stored. These blocks hold the information that makes up the files, allowing for data retrieval during normal system operation. Data blocks are portions of storage in a file system that store the actual content of files and directories. When you create or modify a file, the data is written to these blocks. Each file has a logical structure composed of one or more data blocks, and the file system keeps track of their locations through pointers in the inode. The size of a data block is determined by the file system and affects the efficiency of data storage and retrieval. File systems use data blocks to organize and manage the storage of information, enabling the operating system to efficiently locate and access the content of files on the storage device.
4.) डेटा ब्लॉक वे हैं जहां फ़ाइलों और निर्देशिकाओं की वास्तविक सामग्री संग्रहीत होती है। ये ब्लॉक वह जानकारी रखते हैं जो फ़ाइलें बनाती है, जिससे सामान्य सिस्टम ऑपरेशन के दौरान डेटा पुनर्प्राप्ति की अनुमति मिलती है। डेटा ब्लॉक फ़ाइल सिस्टम में भंडारण के भाग होते हैं जो फ़ाइलों और निर्देशिकाओं की वास्तविक सामग्री को संग्रहीत करते हैं। जब आप कोई फ़ाइल बनाते या संशोधित करते हैं, तो डेटा इन ब्लॉकों में लिखा जाता है। प्रत्येक फ़ाइल में एक या अधिक डेटा ब्लॉक से बनी एक तार्किक संरचना होती है, और फ़ाइल सिस्टम इनोड में पॉइंटर्स के माध्यम से उनके स्थानों का ट्रैक रखता है। डेटा ब्लॉक का आकार फ़ाइल सिस्टम द्वारा निर्धारित किया जाता है और डेटा भंडारण और पुनर्प्राप्ति की दक्षता को प्रभावित करता है। फ़ाइल सिस्टम सूचना के भंडारण को व्यवस्थित और प्रबंधित करने के लिए डेटा ब्लॉक का उपयोग करते हैं, जिससे ऑपरेटिंग सिस्टम स्टोरेज डिवाइस पर फ़ाइलों की सामग्री को कुशलतापूर्वक ढूंढने और उन तक पहुंचने में सक्षम होता है। 

Together, these components form the foundation of a Linux file system, facilitating the organization, storage, and retrieval of data on storage devices.
साथ में, ये घटक लिनक्स फ़ाइल सिस्टम की नींव बनाते हैं, जो भंडारण उपकरणों पर डेटा के संगठन, भंडारण और पुनर्प्राप्ति की सुविधा प्रदान करते हैं।


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.
एक शेल अपने सभी उपयोगकर्ताओं के साथ इंटरैक्ट करता है और फिर मशीन द्वारा समझने योग्य भाषा में व्याख्या करता है। एक कर्नेल सीधे हार्डवेयर के साथ इंटरैक्ट करता है क्योंकि यह उपलब्ध शेल से मशीन-समझने योग्य भाषा को स्वीकार करता है।