Unit 3 - Notes

CSE111

Unit 3: Linux Operating System

1. Linux Operating System: Overview and Features

What is Linux?

Linux is a free, open-source operating system (OS) based on Unix. Created by Linus Torvalds in 1991, it serves as the interface between computer hardware and software applications. Unlike proprietary systems like Windows or macOS, the Linux source code is available to the public for modification and redistribution.

Architecture of Linux

  1. Hardware Layer: Physical devices (RAM, CPU, HDD).
  2. Kernel: The core of the OS. It manages CPU, memory, and peripheral devices.
  3. Shell: A command-line interface (CLI) that interprets user commands and passes them to the kernel.
  4. Utilities/Applications: User-level programs (browsers, text editors, etc.).

Key Features of Linux

  • Open Source: The source code is free to use, modify, and distribute.
  • Multi-User & Multi-Tasking: Multiple users can access system resources simultaneously, and multiple programs can run at the same time without conflict.
  • Security: Highly secure due to strict file permission hierarchies and a lack of widespread malware compared to Windows.
  • Portability: Can run on various hardware architectures (from supercomputers to smartwatches).
  • Stability & Reliability: Linux systems rarely crash and can run for months or years without needing a reboot.
  • Hierarchical File System: All files are arranged in a tree structure starting from the root directory (/).

2. Linux Distribution Versions (Distros)

Since the Linux Kernel is open-source, different organizations combine the kernel with specific software packages, desktop environments, and package managers to create "Distributions."

Popular Distributions:

  1. Ubuntu: The most popular distro for personal use. User-friendly, Debian-based, great hardware support.
  2. Debian: Known for extreme stability. It is the foundation for Ubuntu and Kali Linux.
  3. Fedora: Sponsored by Red Hat. Focuses on innovation and the latest technologies.
  4. Red Hat Enterprise Linux (RHEL): A paid, commercial distribution used widely in corporate servers.
  5. CentOS (Stream): A free version of RHEL, popular for web servers.
  6. Kali Linux: Designed for penetration testing, ethical hacking, and security auditing.
  7. Linux Mint: Interface resembles Windows 7/10, making it ideal for beginners transitioning from Windows.

3. Shell Commands

The Shell is the command-line interpreter. The most common shell is Bash (Bourne Again Shell).

File and Directory Management

Command Description Syntax Example
pwd Print Working Directory. Shows current path. pwd
ls Lists files and directories. ls -l (detailed list)
cd Change Directory. cd /home/user/Documents
mkdir Make Directory. Creates a new folder. mkdir new_folder
rmdir Remove Directory. Deletes empty folders. rmdir old_folder
touch Creates an empty file or updates file timestamps. touch notes.txt
cp Copy files or directories. cp source.txt dest.txt
mv Move (rename) files or directories. mv oldname.txt newname.txt
rm Remove files. rm file.txt or rm -rf folder

File Content Viewing

Command Description Syntax Example
cat Concatenate and display file content. cat file.txt
more / less View file content one screen at a time. less bigfile.txt
head / tail View the first or last few lines of a file. head -n 5 file.txt

System and Process Management

Command Description Syntax Example
ps Process Status. Lists running processes. ps aux
kill Terminates a process using its PID (Process ID). kill 1234
man Manual. Displays the help manual for commands. man ls
clear Clears the terminal screen. clear

Permissions (chmod)

Linux uses a permission system: Read (r=4), Write (w=2), Execute (x=1).

  • chmod: Change Mode. Changes file access permissions.
    • Example: chmod 755 script.sh (Owner: rwx, Group: r-x, Others: r-x).

4. Comparison: Windows vs. Linux OS

Feature Linux Windows
Cost Generally Free (Open Source). Paid (Proprietary license).
Source Code Open (Users can modify). Closed (Only Microsoft can modify).
File System Tree structure starting at / (Root). No drive letters. Drive letters (C:, D:).
Security High security; less prone to viruses. Requires root password for changes. Prone to malware/viruses; requires antivirus software.
Case Sensitivity Case-sensitive (File.txt != file.txt). Case-insensitive (File.txt == file.txt).
Updates Full system updates (software + OS) managed via repositories. OS updates managed by Microsoft; apps updated individually.
Ease of Use Higher learning curve (CLI heavy). User-friendly (GUI heavy).
Kernel Type Monolithic Kernel. Hybrid Kernel (Microkernel + Monolithic).

5. Virtual Machines (VM)

Introduction

A Virtual Machine (VM) is a software-based emulation of a physical computer. It functions as a separate computer running inside your actual computer (the Host).

  • Host OS: The physical computer's operating system.
  • Guest OS: The operating system running inside the VM.

VM Software (Hypervisors)

The software that creates and runs VMs is called a Hypervisor.

  1. Oracle VirtualBox: Free, open-source, cross-platform. Best for students.
  2. VMware Workstation Player: Proprietary, robust, free for personal use.
  3. Microsoft Hyper-V: Built into Windows 10/11 Pro/Enterprise.

Creating and Managing VMs (General Steps)

  1. Download ISO: Obtain the ISO image file of the OS you want to install (e.g., Ubuntu.iso).
  2. Create New VM: Open VirtualBox/VMware and click "New".
  3. Allocate Resources:
    • RAM: Assign memory (e.g., 4GB).
    • Storage: Create a virtual hard disk (e.g., 20GB VDI).
  4. Mount ISO: Attach the downloaded ISO file to the virtual optical drive.
  5. Install: Start the VM. It will boot from the ISO. Follow the on-screen installation prompts.
  6. Snapshot: A management feature that saves the state of the VM at a specific point, allowing you to revert changes if something breaks.

6. File System Basics

What is a File System?

A file system is the method and data structure that an operating system uses to control how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins.

Key Concepts:

  • Metadata: Information about the file (Owner, permissions, creation date).
  • Allocation: How blocks on the disk are assigned to files.
  • Directories: Folders used to organize files.

7. Types of File Systems

1. FAT (File Allocation Table)

  • Overview: Developed by Microsoft for MS-DOS. Simple and widely supported.
  • Versions: FAT12, FAT16, FAT32.
  • Pros: Compatible with almost all OSs (Windows, Mac, Linux, Game Consoles).
  • Cons: FAT32 has a maximum file size limit of 4GB and a max partition size of 32GB (in Windows tools). Lacks security permissions.

2. NTFS (New Technology File System)

  • Note: Sometimes referred to incorrectly as NDFS in exam prompts.
  • Overview: The default file system for modern Windows (NT, XP, 7, 10, 11).
  • Features:
    • Supports huge file sizes (16 EB).
    • Journaling: Keeps a log of changes to recover from crashes.
    • Security: Supports Access Control Lists (ACLs) and encryption.
    • Compression: Native file compression support.

3. HFS / HFS+ (Hierarchical File System)

  • Overview: Developed by Apple for macOS.
  • HFS+ (Mac OS Extended): The primary format for Mac hard drives before the release of APFS (Apple File System).
  • Features: Efficient at managing large files, case-insensitive (usually).

4. UDF (Universal Disk Format)

  • Overview: An open, vendor-neutral file system.
  • Usage: Standard for Optical Media (DVDs, Blu-rays) and sometimes used for flash drives to ensure compatibility across different operating systems.
  • Features: specifically designed for read-only or rewritable media.

5. Extended File System (ext)

  • Overview: The standard file system family for Linux.
  • Evolution:
    • ext2: Good for flash drives (no journaling), but prone to corruption on power loss.
    • ext3: Added Journaling (prevents data corruption).
    • ext4: The current standard for most Linux distros. Supports volumes up to 1 EB and files up to 16 TB. Faster and more reliable than predecessors.

6. GFT / GFS / GPT (Clarification)

  • Note: "GFT" is not a standard commodity file system. In the context of study units, this usually refers to one of the following:
    • GPT (GUID Partition Table): Not a file system, but a standard for the layout of partition tables on a physical hard disk (successor to MBR).
    • GFS (Google File System): A proprietary distributed file system developed by Google for handling large data sets.
    • MFT (Master File Table): The core database of the NTFS file system.
    • Contextual Assumption: In most basic computing exams, if grouped with FAT/NTFS, the examiner may be looking for GPT (partitioning concepts) or simply meant NTFS concepts. Stick to the definition of NTFS and ext4 as the primaries.