Unit III Linux Operating System & Other Shell commands | Cse111 Orientation Of Computing | B.tech CSE

 



Linux Operating System

1. Open Source

  • Definition: The source code of Linux is freely available for anyone to view, modify, and distribute.
  • Benefits: Encourages collaboration, innovation, and transparency in development.

2. Multi-user Capability

  • Definition: Multiple users can log into the system simultaneously.
  • Benefits: Allows for effective resource sharing and personalized environments for each user.

3. Multitasking

  • Definition: Linux can run multiple processes at the same time.
  • Benefits: Enhances efficiency by allowing users to perform several tasks concurrently without slowing down the system.

4. Portability

  • Definition: Linux can run on various hardware platforms, from servers to embedded systems.
  • Benefits: Users can deploy Linux on different devices without needing major modifications.

5. Security

  • Definition: Linux employs a robust permission and user management system.
  • Benefits: Helps protect against unauthorized access and vulnerabilities. Regular updates also contribute to security.

6. Stability and Reliability

  • Definition: Linux systems are known for their uptime and reliability.
  • Benefits: Ideal for servers and critical systems that require continuous operation without crashes.

7. Community Support

  • Definition: A vast and active community contributes to development, troubleshooting, and documentation.
  • Benefits: Provides resources such as forums, wikis, and tutorials for users at all levels.

8. Customizability

  • Definition: Users can modify almost every aspect of the system, from the kernel to the user interface.
  • Benefits: Enables users to tailor their environments to specific needs or preferences.

9. Package Management

  • Definition: Linux distributions come with package managers that simplify software installation and updates.
  • Benefits: Users can easily install, update, or remove software from repositories, ensuring system consistency and security.

10. Command Line Interface (CLI)

  • Definition: Linux provides a powerful command-line interface for system administration and scripting.
  • Benefits: Enables advanced users to perform complex tasks efficiently and automate processes.

11. File System Hierarchy

  • Definition: Linux uses a hierarchical file system structure, making it easier to manage files and directories.
  • Benefits: Organized structure helps in locating files and maintaining system order.

12. Support for Programming Languages

  • Definition: Linux supports various programming languages, such as Python, C, C++, and Java.
  • Benefits: Ideal for developers who can compile and run code easily across platforms.

13. Virtualization Support

  • Definition: Linux can run virtual machines and containers, allowing multiple operating systems or applications to run simultaneously.
  • Benefits: Useful for development, testing, and maximizing resource usage.

14. Networking Capabilities

  • Definition: Robust networking tools and configurations are available.
  • Benefits: Ideal for server environments, Linux can manage complex networking setups with ease.

Linux Distribution Versions

Ubuntu

  • Target Audience: Beginners and general users.
  • Features: User-friendly interface, large community support, regular updates.
  • Variants: Ubuntu Desktop, Ubuntu Server, Ubuntu LTS (Long-Term Support).

Debian

  • Target Audience: Experienced users and server environments.
  • Features: Stability and versatility, extensive package repositories.

Fedora

  • Target Audience: Developers and tech enthusiasts.
  • Features: Cutting-edge features, frequent updates, and focus on innovation.

CentOS

  • Target Audience: Servers and enterprises.
  • Features: Community-supported version of Red Hat Enterprise Linux, stability, and long-term support.

Arch Linux

  • Target Audience: Advanced users.
  • Features: Rolling release model, highly customizable, minimal base installation.

Linux Mint

  • Target Audience: Users transitioning from Windows.
  • Features: User-friendly, based on Ubuntu, with a focus on ease of use.

Installation Process

Download the ISO

  • Obtain the installation image from the distribution’s official website.

Create Bootable Media

  • Use tools like Rufus (Windows) or balenaEtcher (macOS/Linux) to create a bootable USB drive from the downloaded ISO.

Boot from USB

  • Insert the USB drive into the target computer and configure BIOS/UEFI settings to boot from the USB.

Select Installation Options

  • Choose installation language, keyboard layout, and other preferences.

Partitioning

  • Select partitioning method (guided or manual) to allocate disk space. Common options include creating separate partitions for root (/), home (/home), and swap.

Install the System

  • Follow prompts to complete the installation. This includes setting up user accounts and passwords.

Finalize Installation

  • After installation, reboot the system, removing the installation media. Log in to your new Linux environment.

Post-Installation Setup

  • Install updates and additional software as needed, using the package manager specific to the distribution (e.g., APT for Ubuntu/Debian, DNF for Fedora).

Directory Hierarchy of Linux System

1. Single-Level Directory Structure

In a single-level directory structure, all files are stored in a single directory, which can be simpler but less organized. This structure is rarely used in modern Linux systems but can be represented as:

/ (Root)

├── file1.txt

├── file2.txt

├── image.png

└── script.sh

2. Multiple-Level Directory Structure

The multiple-level directory structure is standard in Linux systems. It organizes files and directories in a hierarchical manner, making it easier to manage and locate files. Below is a common representation:

/ (Root)

├── bin/ # Essential user binaries (e.g., ls, cp)

├── boot/ # Boot loader files

├── dev/ # Device files

├── etc/ # Configuration files

├── home/ # User home directories

│ ├── user1/

│ └── user2/

├── lib/ # Shared libraries

├── media/ # Mount points for removable media

├── mnt/ # Temporary mount points

├── opt/ # Optional application software packages

├── root/ # Home directory for the root user

├── sbin/ # System binaries

├── srv/ # Data for services provided by the system

├── tmp/ # Temporary files

├── usr/ # User programs and data

│ ├── bin/ # User binaries

│ ├── lib/ # User libraries

│ └── share/ # Architecture-independent data

└── var/ # Variable data files (e.g., logs, databases)

Key Directories Explained

  • /: The root directory, the top-level directory in the filesystem.
  • /bin: Contains essential user commands.
  • /boot: Contains boot loader files, including the Linux kernel.
  • /etc: Stores configuration files for the system and applications.
  • /home: Home directories for regular users, where personal files and settings are stored.
  • /lib: Contains shared libraries needed by binaries in /bin and /sbin.
  • /usr: Contains user programs and utilities, including applications and libraries.
  • /var: Contains variable files such as logs and spool files that change in size

Disk Partitions in Linux

Disk partitions are divisions of a hard disk that allow the operating system to manage data more efficiently. Each partition can be formatted with different file systems and can be used for different purposes.

Common Types of Partitions

  1. Root Partition (/): The main partition where the operating system is installed.
  2. Home Partition (/home): Stores user data and personal files, allowing for easier upgrades or reinstalls of the OS.
  3. Swap Partition: Used as virtual memory to supplement RAM; helps improve system performance when RAM is full.
  4. Boot Partition (/boot): Contains boot loader files and the Linux kernel; necessary for booting the system.
  5. Data Partitions: For storing data that users or applications need.

Partitioning Schemes

  • MBR (Master Boot Record): Supports up to four primary partitions and is limited to disks up to 2 TB.
  • GPT (GUID Partition Table): Supports larger disks and more partitions (up to 128), with enhanced reliability.

Obtaining Partition Information

Linux provides several tools to view and manage disk partitions:

  • lsblk
    • Lists block devices, showing partition structure, sizes, and mount points.
    • Command:
      • bash command
        • lsblk
  • fdisk
    • A command-line utility for viewing and modifying disk partition tables.
    • To list partitions:
      • bash command
        • sudo fdisk -l
  • parted
    • A more advanced partition manipulation tool that supports GPT and MBR.
    • To start parted:
      • bash command
        • sudo parted /dev/sdX         # Replace sdX with your disk identifier
    • Inside parted, use:
      • bash command
        • print        # To show partition table
  • df
  • Displays disk space usage for file systems, including the mounted partitions.
    • bash Command:
      • df -h
  • blkid
  • Lists all block devices and their attributes, including file system types and UUIDs.
    • bash Command:
      • sudo blkid

Comparison of Windows and Linux OS

Feature Windows Linux
Cost Proprietary software; requires a paid license. Open-source and generally free to use.
User Interface Primarily GUI-focused, designed for general consumers. Offers both GUI and command-line interfaces; highly customizable.
Software Availability Extensive library of commercial software, including popular applications and games. Strong support for open-source software; many applications available via package managers.
Customizability Limited customization options. Highly customizable; users can modify many aspects of the OS.
Security More frequently targeted by malware; requires third-party antivirus. Generally considered more secure; less frequently targeted by malware.
Performance Can be resource-intensive. More lightweight; runs efficiently on older hardware.
System Updates Updates can be intrusive and require reboots. Streamlined updates; users can choose when to apply.
Community Support Official support from Microsoft; large user community. Strong community support with extensive documentation.

Virtual Machines

What are Virtual Machines?

Virtual machines (VMs) allow users to run multiple operating systems on a single physical machine. They simulate hardware, enabling separate instances of different OS environments.

Benefits of Using Virtual Machines

  • Isolation: Each VM runs independently, preventing software conflicts.
  • Testing and Development: Ideal for testing software in different OS environments without needing multiple physical machines.
  • Resource Optimization: Allows for efficient use of hardware resources by running several VMs on a single host.
  • Snapshot and Cloning: VMs can be easily backed up, cloned, or restored to previous states.

Popular Virtual Machine Software

  • VirtualBox: Free, open-source tool that supports multiple operating systems.
  • VMware: Offers robust virtualization solutions for both desktop and server environments.
  • KVM (Kernel-based Virtual Machine): Built into the Linux kernel; provides high-performance virtualization for Linux users.

Other Shell Commands

Common Shell Commands in Linux

Command Description
ls Lists files and directories in the current directory.
cat Displays the contents of a file.
man Displays the manual page for a command.
cd Changes the current directory.
touch Creates an empty file or updates the timestamp of an existing file.
cp Copies files or directories from one location to another.
mv Moves or renames files or directories.
rmdir Removes an empty directory.
mkdir Creates a new directory.
rm Removes files or directories.
chmod Changes the permissions of a file or directory.
pwd Displays the current working directory.
ps Displays information about running processes.
kill Terminates a process by its ID.

Post a Comment

If you have any doubt, Please let me know.

Previous Post Next Post