Essential Concepts of Linux Overview

Aug 31, 2024

Linux Overview Notes

Introduction

  • 96% of viewers not using Linux; only 4% market share.
  • Linux is popular on servers; essential for programmers and developers.
  • Today’s focus: 101 essential concepts of Linux.

Historical Context

  • Unix: Developed in the 70s at AT&T Bell Labs; led to POSIX standardization.
  • Minix: Created in 1987 for academic use, inspired Linus Torvalds to develop Linux in 1991.
  • Linux: Free, open-source under GPL 2.0; refers to the kernel, not the entire OS.

Linux Kernel

  • Written in C; acts as an intermediary between software and hardware.
  • Boot process: Bootloader (usually GRUB) loads the kernel into RAM.
  • Kernel responsibilities:
    • Allocates/deallocates memory for processes.
    • Provides a virtual file system.
    • Interacts with hardware via drivers.

User Space vs Kernel Space

  • Ring 0: Kernel (high privilege).
  • Ring 3: User space (low privilege).
  • System calls allow user applications to request kernel services.

GNU and Core Utilities

  • GNU: Started in 1983 by Richard Stallman; provides core utilities for Linux.
  • Shell: Allows command input; most common is Bash.

Basic Commands

  • echo: Output text to console.
  • man: Shows manuals for commands.
  • ls: Lists files, with flags for details.
  • touch: Creates a new file.
  • cat: Reads file contents.
  • stat: Displays file metadata.
  • rm: Removes files.

Command Redirection and Piping

  • Redirection: > to write output to a file, < for input.
  • Piping: | sends output from one command to another (e.g., cat | sort | uniq).

Bash Scripting

  • Use an editor (Nano, Vim) for scripts.
  • Shebang: Indicates script interpreter.
  • Scripts can automate command sequences.

User and File Management

  • Users have unique UIDs; root user has UID 0.
  • Use su or sudo for elevated privileges.
  • Linux uses groups to manage permissions.

File System Structure

  • Home directory: Personal workspace for logged-in user.
  • Critical directories:
    • /boot: Contains Linux kernel.
    • /dev: External devices.
    • /etc: Configuration files.
    • /var: Log files.
    • /bin: Binaries.

Path and Environment Variables

  • PATH: Environment variable for executable binary directories.
  • Customize using export and .bashrc for persistent settings.

File Permissions

  • Symbolic permissions: Read (r), Write (w), Execute (x).
  • Changing permissions: chmod, changing ownership: chown, and groups: chgrp.

Process Management

  • Each command execution creates a process.
  • View processes with ps and htop.
  • To kill processes, use kill or kill -9 for forceful termination.

Linux Distributions

  • Varied based on target audience:
    • Slackware: Original classic.
    • Debian: Popular, open philosophy.
    • Red Hat: Enterprise-focused.
    • Arch: For advanced users.

Conclusion

  • Familiarize with the terminal and commands for effectiveness.
  • Explore further with resources available in the full course.
  • Mastering Linux enhances programming and development skills.