Summary
Highlights
Linux, a free and open-source operating system, holds a 4% share of the PC market but dominates the server OS landscape. Programmers and developers need to understand Linux because it's where their code often runs. Linux was inspired by Unix, developed in the 1970s, which led to the POSIX standardization. Linus Torvalds developed Linux in 1991, making it free and open-source under GPL 2.0.
Linux is an operating system kernel written in C. It acts as an intermediary between software applications and hardware. During boot-up, the bootloader loads the kernel, which then detects hardware and starts the init system (usually systemd). The kernel manages memory, creates virtual memory, provides a virtual file system (often Ext4), and interacts with peripheral devices via drivers. The kernel operates in Ring 0 (highest privilege), while user applications are in Ring 3. System calls allow user applications to request kernel services.
The GNU project, started in 1983, provides core utilities that make the Linux kernel useful. The terminal is a graphical interface for sending commands via the shell (like Bash). Commands like 'echo' print output, and 'man' provides manuals for commands. Basic file operations include 'touch' to create files, 'ls' to list files, 'cat' to read file contents, and 'rm' to remove them. 'Stat' provides file metadata.
Linux allows combining commands through redirection ('>' for output, '<' for input) and pipes ('|'). Pipes direct the output of one command as input to another, useful for processing data with commands like 'sort' and 'uniq'. For repetitive tasks, Bash scripts can be written in dedicated files using text editors like Nano, Vim, or Emacs. Shebangs at the start of a script tell Linux which interpreter to use.
Users have unique IDs ('whoami', 'id') with 'root' (UID 0) being the superuser. 'sudo' allows running commands with elevated privileges. Linux also has groups for managing permissions for multiple users. The file system starts at '/' (root). Key directories include '/boot' (kernel), '/dev' (devices), '/etc' (config files), '/var' (log files), and '/bin'/'/sbin' (binaries). The 'PATH' environment variable defines directories where executables are searched.
File permissions are represented by nine characters (rwx for read, write, execute) for the owner, group, and others. These can also be represented numerically (octal notation). The principle of least privilege should be followed. Permissions can be modified with 'chmod', and file ownership with 'chown' and 'chgrp'.
Every command or program creates a process managed by the kernel, viewable with 'ps' or 'htop'. Background processes can be created with an '&'. The 'cron' utility schedules tasks. The 'kill' command sends signals to terminate processes ('Sigterm' for graceful, 'Sigkill' for forceful). Other useful utilities include 'grep' (text search), 'sed' (text modification), 'gzip' (compression), and 'tar' (archiving).
A Linux distribution is a complete OS built on the Linux kernel, each with a default set of software for a target audience. Distros can have different package managers (e.g., yum, pacman) and release schedules (fixed or rolling). Desktop environments like GNOME or KDE Plasma significantly impact the user experience. Notable distro families include Slackware, Debian, Red Hat, and Arch.