CSE105Semester 1 • 2 CreditsSpecialization Subjects

Creative Engineering Workshop

Creative Engineering Workshop is a practical, skill-oriented course on Linux/UNIX systems covering installation and configuration, file system navigation and management, permissions and ownership, filters and regular expressions, user and group administration, process management, shell scripting, and development tools including Git version control.

11 Units • Notes • Model Answers • MCQs
Select Course Unit (11 Units)
Active: Unit 1
Unit 1:Unit 1: Linux Basics and Installation
7 min read•High-Yield Unit Guide

Unit 1: Linux Basics and Installation

Unit 1 Exam Focus & Core Takeaways

Review the core definitions, standard architectures, and syntax patterns below. Pay special attention to sections highlighted with bullet points for your mid-term and end-term subjective questions.

Unit 1: Linux Basics and Installation

1. Why It Matters

Linux powers over 90% of the world's top 500 supercomputers, the vast majority of public cloud infrastructure (AWS, Azure, Google Cloud), the global Internet backbone, container orchestration platforms (Docker, Kubernetes), and billions of Android mobile devices. For a computer science engineer, proficiency with the Linux operating system is not merely an optional elective—it is the foundational environment for modern software development, systems engineering, cybersecurity, DevOps, and cloud computing.

Mastering Linux installation, architectural layers, partition management, and deployment strategies (bare-metal dual booting, virtualization, and WSL) equips students with the systems-level intuition needed to understand process scheduling, memory virtualization, device drivers, and POSIX compliance.


2. Key Concepts & Architecture

2.1 The UNIX Philosophy and Linux Genesis

In 1969 at AT&T Bell Laboratories, Ken Thompson, Dennis Ritchie, and Douglas McIlroy developed UNIX to create a simple, elegant, multi-user, and multitasking computing platform. The fundamental design tenets of the UNIX philosophy include:

  1. Modularity & Simplicity: Write programs that do one thing and do it exceptionally well.
  2. Composability via Text Streams: Write programs to work together. Expect the output of every program to become the input to another, as-yet-unknown program using standardized text streams.
  3. Everything is a File: Represent system entities—regular data files, directories, physical storage disks, memory buffers, serial communication ports, and inter-process communication pipes—as uniform streams of bytes accessed via standard file descriptors (open, read, write, close).
  4. Portability: Writing operating systems in high-level languages (specifically the C language, invented alongside UNIX) rather than hardware-dependent assembly code.

In 1991, Finnish university student Linus Torvalds released the Linux kernel as a free, 32-bit POSIX-compliant monolithic kernel for Intel 80386 microprocessors. Paired with the userland utilities, compilers, and libraries built by Richard Stallman's GNU Project (initiated in 1983 under the Free Software Foundation), the modern GNU/Linux operating system was born under the GNU General Public License (GPL).

2.2 System Architecture: The Four Rings of Linux

A Linux operating system is organized into distinct hierarchical abstraction layers:

CODE
+-----------------------------------------------------------+
|               User Applications & GUIs                     |
|         (Web Browsers, Editors, Python, IDEs)             |
+-----------------------------------------------------------+
                              ▲
                              │ Standard I/O / GUI Events
                              ▼
+-----------------------------------------------------------+
|          System Utilities & Shell Interface               |
|            (bash, zsh, coreutils, grep, sed, awk)         |
+-----------------------------------------------------------+
                              ▲
                              │ System Call Interface (syscalls)
                              │ (fork, execve, open, read, write)
                              ▼
+-----------------------------------------------------------+
|                       LINUX KERNEL                        |
|  - Process Scheduler        - Virtual Memory Management   |
|  - Virtual File System (VFS)- Hardware Device Drivers     |
|  - Network Protocol Stack   - Security & IPC              |
+-----------------------------------------------------------+
                              ▲
                              │ Machine Instructions / DMA / IRQ
                              ▼
+-----------------------------------------------------------+
|                      PHYSICAL HARDWARE                    |
|             (CPU, RAM, NVMe/SATA Disks, NICs, GPU)        |
+-----------------------------------------------------------+
  1. Physical Hardware: The underlying silicon, including the central processing unit (CPU), dynamic RAM, solid-state drives, disk controllers, network interface cards (NICs), and peripherals.
  2. The Kernel: The core program that executes in CPU Ring 0 (supervisor/kernel mode) with unrestricted hardware access. It arbitrates shared resources, manages virtual memory address spaces, schedules processes across CPU cores, and controls peripheral drivers.
  3. The System Call Interface (syscalls): The secure boundary separating unprivileged user-space code (CPU Ring 3) from privileged kernel-space operations. Applications invoke services (e.g., allocating memory with brk/mmap, reading a disk file with read, or spawning a process with clone) by executing software traps that switch CPU execution rings.
  4. The Shell and User Utilities: The command-line interpreter (bash, zsh, sh) and standard utilities (GNU coreutils) that allow human administrators and automated scripts to interact with the system.

2.3 Kernel vs. Distribution (Distro)

A frequent misconception among novices is treating "Linux" and "Ubuntu" as synonymous:

  • The Kernel: Purely the core resource manager (e.g., Linux 6.x) maintaining process execution, virtual memory, network stacks, and hardware drivers. It has no bundled package manager, graphical desktop, or browser.
  • A Distribution (Distro): A complete, bootable operating system built by assembling the Linux kernel, GNU toolchain (gcc, glibc), system initialization daemon (systemd), a package management framework, desktop environments, and pre-compiled application suites.

Major Distribution Families:

  • Debian Family (Debian, Ubuntu, Linux Mint, Kali Linux): Utilizes the dpkg packaging system with .deb binaries and the apt (Advanced Package Tool) frontend. Known for rock-solid stability, comprehensive software repositories, and extensive community documentation.
  • Red Hat Family (RHEL, Fedora, CentOS Stream, AlmaLinux, Rocky Linux): Utilizes RPM packages managed by the dnf / yum package managers. Dominates enterprise enterprise server infrastructure, high-performance computing clusters, and enterprise container hosting.
  • Arch Family (Arch Linux, Manjaro): Utilizes the pacman package manager following a rolling-release model, providing the absolute latest upstream software kernels without fixed version release cycles.
  • openSUSE Family: Utilizes zypper package management and YaST (Yet another Setup Tool) configuration suites.

2.4 Disk Partitioning, Firmware, and Boot Architecture

Firmware & Partition Tables: Legacy BIOS vs. Modern UEFI

DimensionLegacy BIOS + MBRModern UEFI + GPT
Firmware TypeBasic Input/Output System (16-bit legacy)Unified Extensible Firmware Interface (64-bit modular)
Partition Table SchemeMaster Boot Record (MBR)GUID Partition Table (GPT)
Max Disk Addressability2.2 Terabytes (TB)9.4 Zettabytes (ZB) (virtually unlimited)
Max Primary Partitions4 primary partitions (or 3 primary + 1 extended)128 primary partitions natively
Boot IntegrityNo built-in cryptographic signature validationSecure Boot verifies cryptographic signatures of bootloader binaries
Boot LocationFirst 512-byte sector of the drive (LBA 0)Dedicated FAT32 EFI System Partition (ESP) mounted at /boot/efi

Linux Filesystem Partitioning Layout

When installing Linux on physical hardware, allocating dedicated partitions improves stability and data integrity:

  1. EFI System Partition (/boot/efi): A small FAT32 partition (100 MB–512 MB) flagged with boot, esp, containing UEFI boot binaries such as GRUB (grubx64.efi) and shim loaders.
  2. Root Partition (/): The primary filesystem containing the operating system binaries, kernel images, configuration files (/etc), and system libraries (/usr, /lib). Typically formatted with ext4, xfs, or btrfs. Recommended size: 25 GB–50 GB minimum.
  3. Swap Space (swap): Dedicated unformatted disk space or a swap file that serves as virtual memory overflow when physical RAM is exhausted, and holds active memory state during system hibernation.
  4. Home Partition (/home): Optional separate partition storing personal user profiles, documents, downloads, and custom configurations. Keeping /home separate allows system reinstallation or OS upgrades without wiping user files.

2.5 Deployment Methods & Environments

CODE
+-----------------------------------------------------------------------------------+
|                        LINUX DEPLOYMENT METHODOLOGIES                             |
+-----------------------------------------------------------------------------------+
| 1. Bare-Metal Dual Boot | Direct hardware execution, maximum performance for GPU/ |
|                         | compute, requires disk repartitioning and GRUB2 setup.  |
|-------------------------+---------------------------------------------------------|
| 2. Virtualization (VM)  | Safe sandboxing inside host OS (VirtualBox/VMware),     |
|                         | isolated virtual disk (.vdi/.vmdk), zero dual-boot risk.|
|-------------------------+---------------------------------------------------------|
| 3. Windows Subsystem    | Fast CLI workflows inside Windows; WSL2 uses a real     |
|    for Linux (WSL)      | lightweight Linux kernel running inside Hyper-V utility.|
|-------------------------+---------------------------------------------------------|
| 4. Live USB / Live CD   | Portable OS running from RAM, hardware testing sandbox, |
|                         | emergency system rescue and disk recovery.              |
+-----------------------------------------------------------------------------------+

1. Bare-Metal Dual Booting

  • Installs Linux directly alongside Windows on separate disk partitions.
  • Managed by GRUB2 (Grand Unified Bootloader 2), which probes installed operating systems via os-prober and presents an interactive boot menu at startup.
  • Critical Considerations:
    • Windows Fast Startup: Must be disabled in Windows Control Panel. Fast Startup uses a hybrid-hibernation state that leaves NTFS partitions locked in an unclean state; writing to them from Linux can cause catastrophic filesystem corruption.
    • Secure Boot: Many Linux distributions (Ubuntu, Fedora) provide Microsoft-signed shim bootloaders, allowing installation with Secure Boot enabled.

2. Virtual Machine Installation (VirtualBox & VMware)

  • Hypervisor Classification:
    • Type 1 (Bare-Metal): Runs directly on bare host hardware without an underlying OS (e.g., VMware ESXi, KVM, Xen, Proxmox).
    • Type 2 (Hosted): Runs as an application inside a host operating system (e.g., Oracle VM VirtualBox, VMware Workstation Player).
  • Virtual Disk Images: Stored as single container files on the host drive (e.g., .vdi for VirtualBox, .vmdk for VMware). Can be dynamically allocated (grows as data is added) or fixed size (pre-allocates all storage immediately, yielding faster write speeds).
  • Guest Additions / Tools: Specialized device drivers and system services installed inside the guest OS that enable hardware graphics acceleration, seamless mouse pointer integration, shared clipboard, bidirectional drag-and-drop, and dynamic display resolution resizing.

3. Windows Subsystem for Linux (WSL)

  • WSL1: A binary compatibility translation layer that translates Linux system calls into corresponding Windows NT kernel executive calls in real-time. Suffers from slow file system I/O when accessing Windows files.
  • WSL2: Utilizes a lightweight, highly optimized Hyper-V utility virtual machine running a genuine Microsoft-maintained Linux kernel. Provides full system call compatibility, support for Linux containers (Docker), and near-native computational performance.

4. Live USB with Persistence vs. Non-Persistent

  • Flashed from an ISO image using tools like Rufus, Balena Etcher, or the Linux CLI utility dd.
  • Non-Persistent: Loads entirely into system RAM (initramfs/overlayfs). Any created files, installed packages, or configuration tweaks evaporate upon reboot.
  • Persistent Storage: Carves out a secondary partition on the USB drive, saving file modifications and updates across reboots.

2.6 Desktop Environments & Display Systems

Linux separates the underlying command-line operating system from graphical user interfaces:

  • Display Server Protocol: The communication layer between GUI applications and hardware input/output devices.
    • X11 (X Window System): The venerable client-server protocol used for four decades. Powerful network transparency, but carries significant architectural bloat and security isolation flaws.
    • Wayland: The modern, secure replacement protocol where the compositor acts as the display server, eliminating legacy X11 inefficiencies and preventing rogue client apps from snooping on keystrokes across other windows.
  • Popular Desktop Environments (DEs):
    • GNOME: Modern, minimalist design based on the GTK toolkit and Mutter window manager; default on Ubuntu and Fedora.
    • KDE Plasma: Highly customizable, modular, lightweight desktop built upon the Qt toolkit and KWin window manager.
    • XFCE / LXQt: Extremely lightweight desktop environments tailored for resource-constrained hardware and embedded devices.

3. High-Yield Command Syntax & Step-by-Step Workflows

Creating a Bootable Live USB via Command Line (dd)

In Linux or macOS, an ISO can be written directly to a raw block device:

bash
# Identify target USB block device (e.g., /dev/sdb - NEVER select the system drive /dev/sda!)
lsblk

# Write image to device using block size of 4MB and sync buffers to disk
sudo dd if=ubuntu-24.04-desktop-amd64.iso of=/dev/sdb bs=4M status=progress oflag=sync

Caution: dd is colloquially termed "disk destroyer" because overwriting the wrong partition table causes irreversible data loss.

Inspecting Hardware, Disks, and Firmware from Terminal

bash
# Check if booted in UEFI or Legacy mode (presence of /sys/firmware/efi confirms UEFI)
[ -d /sys/firmware/efi ] && echo "UEFI Mode Active" || echo "Legacy BIOS Active"

# Display block devices, partition labels, sizes, and mount points
lsblk -f

# Check CPU architecture details and virtualization capabilities
lscpu | grep -E "Model name|Virtualization"

# Display available physical memory and swap utilization
free -h

4. Common Misconceptions & Pitfalls

  • Confusing /dev/sda with /dev/sda1: In Linux device naming, /dev/sda represents the entire physical storage drive (block device), whereas /dev/sda1 refers specifically to the first partition on that drive.
  • Assuming Swap must be twice physical RAM: While older UNIX guidelines recommended 2×RAM2 \times \text{RAM}, modern systems with 16 GB–64 GB RAM generally require only 4 GB–8 GB swap (or matching RAM size if hibernation is required).
  • Formatting the EFI System Partition during dual-booting: Never format the existing Windows EFI partition when installing Linux; simply configure the Linux installer to mount it at /boot/efi. Formatting it wipes the Windows Boot Manager!
  • Believing Linux has drive letters like C: and D:: Linux implements a unified, single-rooted hierarchical directory tree starting at root (/). Secondary drives and partitions are mounted into existing directories (e.g., /mnt/data or /media/usb).

5. Exam Tips & Strategy

  • Architecture Layers: Be prepared to draw and label the four-tier architectural diagram (Hardware →\rightarrow Kernel →\rightarrow Shell/Syscalls →\rightarrow Applications).
  • BIOS vs. UEFI Comparison: Memorize key metrics: 2.2 TB limit and 4 primary partitions for MBR; 9.4 ZB and 128 primary partitions for GPT.
  • WSL1 vs. WSL2 Differences: Remember that WSL1 translates syscalls at runtime; WSL2 uses a real Linux kernel in a lightweight Hyper-V VM with full Docker compatibility.

6. Quick Review Summary

  • UNIX Origins: Thompson & Ritchie at Bell Labs (1969); Linus Torvalds released the Linux kernel in 1991 under GNU GPL.
  • UNIX Philosophy: Modularity, text streams, pipes, and "everything is a file".
  • Kernel vs. Distro: The kernel handles processes and memory; distros bundle the kernel with package managers (apt, dnf, pacman) and user utilities.
  • UEFI + GPT: Replaced BIOS + MBR, offering faster boot times, Secure Boot integrity verification, and support for massive drives.
  • VirtualBox / VMware: Type 2 hosted hypervisors ideal for safe, isolated experimentation.