Linux Operating System — Study Notes

Unit 01

Linux OS, Shell, Directory Structure and File Types

6 Questions 5 Marks Each Linux Operating System
01
5 Marks Question

Define Linux OS. Explain Its Features

Linux is a free and open-source operating system based on the UNIX operating system. Its source code is freely available, so users can inspect and modify it. Linux can be installed on desktops, servers, smartphones, supercomputers, in-car entertainment systems, and medical devices.

The notes mention that Linux was developed by Linus Torvalds in 1991, inspired by UNIX and MINIX.

Features of Linux Operating System

Portable
Linux can work on different types of hardware platforms.
Open Source
The source code is freely available and can be improved by multiple developers.
Multi-User
Multiple users can access system resources such as memory and application programs at the same time.
Multiprogramming
Multiple applications can run simultaneously.
Hierarchical File System
System files and user files are properly organized in a standard structure.
Shell
A special interpreter is provided to execute operating system commands and run application programs.
Security
Linux provides strong security through password protection, controlled access to files, and encryption.
Conclusion Linux is a free, open-source and powerful operating system that provides portability, multi-user support, multiprogramming, hierarchical file management, shell support, and security.
02
5 Marks Question

Explain Components of Linux Operating System

The Linux Operating System is composed of five main components that work together to provide a complete operating system.

Linux Architecture

+------------------+
|   Applications   |
+------------------+
|  GNU Utilities   |
+------------------+
|      Shell       |
+------------------+
|      Kernel      |
+------------------+
|     Hardware     |
+------------------+
Hardware
The physical part of the computer system, including the CPU, RAM, hard disk/SSD, keyboard, mouse, monitor and other peripherals.
Kernel
The core of Linux. It handles process management, memory management, device drivers, file system management and networking.
Shell
A command-line interpreter that accepts user commands, converts them into instructions for the kernel, and supports scripting.
GNU Utilities
Command-line tools used for system administration, file management and text processing, such as ls, cd, rm, cp, grep, sed and awk.
Applications
Software programs installed by users to perform specific tasks, such as web browsers, word processors, games and multimedia players. They interact with the kernel through system calls and libraries.
Conclusion The Linux Operating System consists of Hardware, Kernel, Shell, GNU Utilities and Applications. Together, these components provide an efficient, secure and user-friendly operating system.
03
5 Marks Question

Explain Shell and Its Types

A Shell is a command-line interpreter that provides an interface between the user and the Linux system. It interprets commands entered by the user and allows them to execute commands, programs and scripts. A collection of commands stored together is known as a Shell Script.

The three important types of shells in the notes are Bash, Zsh and Dash.

01
Bash (Bourne Again Shell)

Bash is a free and enhanced version of the Bourne Shell and is the default shell on most Linux distributions.

Features: command history, tab completion, command aliasing, job control, arithmetic operations, conditions, loops, functions and strong scripting support.

02
Zsh (Z Shell)

Zsh is similar to Bash but provides additional and improved features for both command interpretation and shell scripting.

Features: advanced tab completion, themes and plugins, better syntax highlighting and error correction, Bash compatibility and improved globbing.

03
Dash (Debian Almquist Shell)

Dash is a small, fast and POSIX-compliant shell mainly used for executing shell scripts rather than interactive use.

Features: very fast, lightweight, uses little memory, POSIX-compliant, used for scripts and startup tasks, and is the default /bin/sh on many Debian-based systems.

Shell Main Feature Mainly Used For
BashPowerful and widely usedGeneral use & scripting
ZshAdvanced features, themes & pluginsInteractive use & scripting
DashFast and lightweightSystem/startup scripts
Conclusion The Shell acts as an interface between the user and Linux system. Bash is widely used and powerful, Zsh provides advanced interactive features, while Dash is lightweight and optimized for fast script execution.
04
5 Marks Question

Explain Linux Directory Structure

The Linux Directory Structure, also known as the File System Hierarchy Standard (FHS), defines a standard way of organizing files and directories in Linux. Linux uses a hierarchical tree structure, where the root directory (/) is at the top and all other files and directories are organized under it.

Linux Directory Structure

                    /
          ┌─────────┼─────────┐
        /bin       /etc      /home
         │          │          │
       /boot       /dev       /usr
         │          │          │
        /lib        /var       /tmp
Directory Purpose
/Root directory; top-level directory of the entire file system.
/binContains essential command binaries required for basic system operations.
/bootContains files required for booting the system, such as the kernel and boot-loader configuration.
/devContains device files representing hardware such as hard drives and terminals.
/etcContains system-wide configuration files.
/homeContains home directories of regular users, including their personal files and settings.
/libContains shared library files required for running programs.
/mediaContains mount points for removable media such as USB drives and CDs.
/mntUsed as a temporary mount point for file systems and storage devices.
/optContains additional or add-on application software packages.
/rootHome directory of the root user.
/sbinContains system binaries generally used by the system administrator.
/srvStores data for services such as web servers and FTP.
/tmpStores temporary files that are deleted when the system restarts.
/usrContains most user utilities, applications, and read-only user data.
/varContains variable data such as logs, spool files, and temporary email files.
Conclusion The Linux directory structure organizes files in a hierarchical tree starting from the root (/) directory. Each directory has a specific purpose, making it easier to locate files and manage the Linux system efficiently.
05
5 Marks Question

Explain File and Its Types in Linux

In Linux, everything is treated as a file. Files are used to store data, organize information, represent hardware devices and provide communication between processes.

Linux files are broadly classified into three types: Regular Files, Directory Files and Special Files.

Regular Files
The most common type of file in Linux. They contain data that can be read and modified. Examples include text files, executable programs, images and configuration files. In ls -l, a regular file is represented by -.
Directory Files
Used to organize other files and directories. They provide a hierarchical structure to the file system. In ls -l, a directory is represented by d.
Special Files
Represent hardware devices or communication endpoints in Linux. The notes mention character special files, block special files, symbolic links, hard links, sockets and named pipes (FIFO).
Character Special Files
Handle data serially, such as a keyboard or mouse. Example: /dev/tty.
Block Special Files
Handle data in fixed-size blocks, such as hard disks. Example: /dev/sda.
Symbolic Links
Act like shortcuts that point to another file or directory.
Hard Links
Associate multiple filenames with the same data.
Sockets
Used for communication between processes.
Named Pipes (FIFO)
Allow processes to communicate with each other.

Identifying File Types

Linux provides commands to identify the type of a file.

file filename
ls -l
Conclusion Linux treats everything as a file. The three main file types are Regular Files, Directory Files and Special Files. Regular files store data, directories organize files, and special files represent devices or communication mechanisms.
06
2 Marks Question

Explain Symbolic Link, Hard Link and Pipes

01
Symbolic Link

A Symbolic Link (Symlink) acts like a shortcut that points to another file or directory.

02
Hard Link

A Hard Link associates multiple filenames with the same data block. Thus, different filenames can refer to the same file data.

03
Pipes

A Pipe is used for communication between processes. A Named Pipe (FIFO — First In, First Out) can allow two unrelated processes to communicate with each other.

In short Symbolic Link → shortcut to another file, Hard Link → multiple names for the same data, Pipe → communication between processes.