Linux Unit 1
Linux Unit 1
The history of Linux and Unix is intertwined, as Linux was inspired by Unix and shares many of its
principles.
1. Unix
Origins (1969):
Unix was developed at Bell Labs by Ken Thompson, Dennis Ritchie, and others. It was initially
created as a simple, multi-tasking system for the PDP-7 minicomputer.
Goals:
Designed with a hierarchical file system and tools philosophy: "Do one thing, do it well."
Key Developments:
1975: Bell Labs released Unix under a license for universities, fostering widespread
adoption in academia.
1980s: Variants like BSD (Berkeley Software Distribution) emerged, influencing modern
systems.
Influence:
Unix became the foundation for many operating systems, including Solaris, AIX, and later Linux.
2. Linux
Origins (1991):
Linux was created by Linus Torvalds, a Finnish student, as a free alternative to Unix-based
operating systems. He initially developed the Linux kernel as a personal project on a MINIX
system.
Timeline:
1991: Linus Torvalds announced the first Linux kernel (v0.01) on Usenet, stating, “Just a
hobby, won’t be big.” It was released under the GNU General Public License (GPL).
1992-1994: The kernel was integrated with GNU tools, forming the complete GNU/Linux
system.
Philosophy:
3. Portability:
Linux can run on a wide range of hardware platforms, from embedded systems to mainframes.
4. Security:
Includes built-in firewalls (e.g., iptables) and tools for secure networking.
6. Customization:
Users can choose from various desktop environments (e.g., GNOME, KDE) and window
managers, or even build their own version.
Components of Linux
1. Kernel:
The core part of Linux that manages hardware resources and facilitates communication between
software and hardware.
Types: Monolithic kernel, supporting features like process management, file systems,
and device drivers.
2. System Libraries:
These provide essential functions and services (e.g., glibc for C programs).
3. System Utilities:
Tools for managing the system, such as the cp, ls, and rm commands.
4. Shell:
The command-line interface (e.g., Bash, Zsh) for interacting with the OS.
5. File System:
Linux supports various file systems, including ext4, XFS, and Btrfs, providing hierarchical
organization.
Linux Distributions
Linux comes in various flavors, known as distributions (distros), each tailored for specific needs:
Advantages of Linux
Cost-Effective: Free to use and distribute.
High Performance: Efficient resource utilization, ideal for servers and heavy computing.
Applications of Linux
1. Servers: Linux dominates the server market due to its stability and security.
2. Development: Preferred for programming, with support for multiple languages and tools.
5. Mobile: Android, the most popular mobile OS, is based on the Linux kernel.
Customization.
Open-source nature.
b. Kernel Layer
The Core Component:
The kernel is the central part of the Linux OS, responsible for managing system resources and
hardware communication.
Main Functions:
Type:
Linux uses a monolithic kernel, meaning most system functions (e.g., drivers, file systems,
networking) run in kernel space for efficiency.
c. Shell Layer
Role:
The shell acts as a bridge between the user and the kernel. It interprets commands and passes
them to the kernel for execution.
Types of Shells:
Bash (Bourne Again Shell): Default shell for most Linux distributions.
Modes of Interaction:
Graphical User Interface (GUI): Modern Linux distributions also support graphical tools
for ease of use.
d. System Libraries
Role:
Libraries contain reusable code that applications and the kernel use to perform standard
functions (e.g., file handling, I/O operations).
Example:
The GNU C Library (glibc) is essential for C programming and system calls.
e. User Applications
Role:
Applications and utilities are programs users interact with to perform specific tasks (e.g., text
editors, browsers, compilers).
Examples:
/ (Root): The base of the file system. All directories are subdirectories of /.
Components:
Simplified Diagram
User Applications
System Shell
System Libraries
Kernel
Hardware
Customizability: Users can swap shells, GUIs, and even kernel modules.
Security: Separation between user space (applications) and kernel space (core OS) ensures stability and
security.
5. Run Installer:
6. Configure Settings:
Choose language, keyboard layout, time zone, and create a user account.
7. Complete Installation:
Wait for files to copy, then reboot.
8. Post-Installation:
Role:
Provides basic graphical functionalities like displaying windows, handling user input, and
managing screens. It does not dictate how the desktop looks; instead, it serves as the underlying
protocol for GUI applications.
Features:
Network transparency: Applications can run on one machine and display on another.
Features:
A clean and modern interface with activities overview for managing applications.
Built-in applications like Files (file manager), GNOME Terminal, and Settings.
Customization via GNOME extensions.
Usage:
Default in distributions like Ubuntu, Fedora, and Debian.
Ideal For:
Users seeking a simple and elegant desktop experience.
Features:
Applications: Includes tools like Dolphin (file manager), Konsole (terminal), and Okular
(PDF viewer).
Usage:
Default in distributions like KDE Neon, Kubuntu, and openSUSE.
Ideal For:
Users who prefer a Windows-like interface with advanced customization options.
Desktop Operations
Desktop operations refer to basic tasks you perform within a desktop environment. Here are common
operations:
b. File Management
Nautilus (GNOME
Dolphin (KDE)
c. Application Management
Launch Applications
Switch Between Applications
d. System Customization
Change Wallpaper
Panel/Dock Customization
e. System Settings
Manage network connections, power settings, user accounts, and updates from the system
settings interface.
Editors in Linux
Linux provides various text editors to create, view, and modify files. These editors can be categorized into
two types:
1. Types of Editors
a. Command-Line Editors
Operate in a terminal environment.
b. Graphical Editors
Require a graphical environment (GUI).
2. The vi Editor
The vi editor (and its improved version, vim) is a popular command-line editor in Linux. It is fast,
lightweight, and comes pre-installed in most Linux distributions.
Modes in vi:
Command Mode (default)
Insert Mode
Ex Mode
3. Basic Commands in vi
a. Starting vi:
Open a file:
vi filename
vi -R filename
b. Navigation Commands:
h: Move left.
l: Move right.
j: Move down.
k: Move up.
e. Editing Commands:
x: Delete the current character.
f. Search Commands:
/pattern: Search forward for "pattern."
g. Replace Commands:
Replace a word under the cursor:
:s/old/new
:%s/old/new/g
:split filename
:vsplit filename
4. Advantages of vi/vim
Lightweight and available on all Unix/Linux systems.