diff --git a/Linux/LPIC1/1-runlevels.md b/Linux/LPIC1/1-runlevels.md new file mode 100644 index 0000000..876423d --- /dev/null +++ b/Linux/LPIC1/1-runlevels.md @@ -0,0 +1,84 @@ +# 🐧 Linux Runlevels Guide + +This guide provides a concise overview of traditional **runlevels** in Linux systems, particularly for **Red Hat** and **Debian**-based distributions. Runlevels define specific states of system operation, historically managed by the `init` system. + +--- + +## 🔄 System Boot Sequence + +```plaintext +BIOS → Bootloader → Kernel → init +``` + +* **BIOS**: Performs hardware checks via **POST** (Power-On Self Test). +* **Bootloader**: Loads the kernel. +* **Kernel**: Initializes system and mounts the root filesystem. +* **init**: Launches system processes based on the selected runlevel. + +--- + +## 📊 Runlevels Comparison + +| Runlevel | Description | Red Hat | Debian | +| -------- | ----------------------------------- | ---------------- | --------------- | +| 0 | Halt / Shutdown | ✅ Supported | ✅ Supported | +| 1 | Single-User Mode | ✅ Supported | ✅ Supported | +| 2 | Multi-User (No Network) | ❌ (Includes Net) | ✅ Supported | +| 3 | Multi-User (Network, No GUI) | ✅ Supported | ✅ Supported | +| 4 | User-Defined / Custom | ✅ Supported | ✅ Supported | +| 5 | GUI Mode / *(Halt on some systems)* | ✅ GUI Mode | ⚠️ Custom/Halt? | +| 6 | Reboot | ✅ Supported | ✅ Supported | + +> 💡 **Notes**: +> • **Runlevel 5** on Red Hat typically launches a full graphical environment (GUI). +> • On Debian, runlevels 2–5 are often configured identically and can be customized. +> • Runlevel behavior is configurable via `/etc/inittab` (SysVinit systems). + +--- + +## 🔧 Useful Commands + +### ✅ Check Current Runlevel + +```bash +runlevel +``` + +### 🔁 Change Runlevel + +```bash +telinit +``` + +or + +```bash +init +``` + +> ⚠️ **Caution**: Switching runlevels may stop services or terminate user sessions. Use carefully on production systems. + +--- + +## 🚀 Modern Systems: systemd Targets + +Most modern Linux distributions use **systemd**, which replaces runlevels with **targets**. + +| Runlevel | systemd Target | +| -------- | ------------------- | +| 0 | `poweroff.target` | +| 1 | `rescue.target` | +| 3 | `multi-user.target` | +| 5 | `graphical.target` | +| 6 | `reboot.target` | + +### 📌 Common systemd Commands + +```bash +# Show default target +systemctl get-default + +# Change to graphical mode +systemctl isolate graphical.target +``` + diff --git a/Linux/LPIC1/directorys.md b/Linux/LPIC1/2-directorys.md similarity index 100% rename from Linux/LPIC1/directorys.md rename to Linux/LPIC1/2-directorys.md diff --git a/Linux/LPIC1/3-package-managers.md b/Linux/LPIC1/3-package-managers.md new file mode 100644 index 0000000..88b7c2d --- /dev/null +++ b/Linux/LPIC1/3-package-managers.md @@ -0,0 +1,75 @@ +# 📦 Linux Libraries & Package Management + +This guide provides a quick overview of **library types**, **package sources**, and **Debian-based package management** commands using `apt`. + +--- + +## 📚 Library Types + +Linux supports two main types of libraries: + +1. **Static Libraries (`.a`)** + - Linked at **compile-time** + - Included in the final binary + - Larger file size, faster execution + +2. **Shared Libraries (`.so`)** + - Linked at **run-time** + - Saved separately from the binary + - Saves space and allows updates without recompiling + +--- + +## 📦 Package Sources + +### ✅ Official Packages +Provided and maintained by the distribution (e.g., Debian, Ubuntu, Red Hat). + +### 🌐 Third-Party Packages +Created by external developers or organizations. Use with caution and verify trustworthiness. + +--- + +## 🏬 Linux Package Managers + +### 📦 Debian-based Systems +- **Package Manager**: `apt` +- **Low-level Tool**: `dpkg` +- **Package Format**: `.deb` + +### 📦 Red Hat-based Systems +- **Package Manager**: `yum` or `dnf` (newer) +- **Low-level Tool**: `rpm` +- **Package Format**: `.rpm` + +--- + +## 🌍 Package Mirrors + +Mirrors are alternative download sources for package repositories, often closer geographically for faster updates. + +To sync with package mirrors and get the latest updates: + +```bash +sudo apt update +``` + +--- + +## 🔧 Common `apt` Commands + +| Command | Description | +|--------------------------|---------------------------------------| +| `apt update` | Refresh package lists | +| `apt upgrade` | Upgrade all installed packages | +| `apt list` | List packages | +| `apt show ` | Show details of a package | +| `apt install ` | Install a new package | +| `apt reinstall `| Reinstall an existing package | +| `apt remove ` | Remove a package (keep config files) | +| `apt purge ` | Remove package **and** config files | +| `apt-cache search `| Search for a package | +| `apt autoremove` | Remove unused dependencies | + +> 🔐 Use `sudo` before these commands when required. + diff --git a/Linux/LPIC1/runlevels.md b/Linux/LPIC1/runlevels.md deleted file mode 100644 index 16eaa31..0000000 --- a/Linux/LPIC1/runlevels.md +++ /dev/null @@ -1,59 +0,0 @@ -# Linux Runlevels Guide - -This document outlines the standard runlevels for **Red Hat** and **Debian**-based systems. Runlevels are used by `init` systems to define different states or modes of operation for the system. - ---- - -## 📊 Runlevels Overview - -| Runlevel | Description | Red Hat | Debian | -| -------- | ------------------------------------ | ------------ | --------------- | -| 0 | Halt | ✅ Supported | ✅ Supported | -| 1 | Single User Mode | ✅ Supported | ✅ Supported | -| 2 | Multi-user (No Network) | ❌ (HaveNet) | ✅ Supported | -| 3 | Multi-user (Network, No GUI) | ✅ Supported | ✅ Supported | -| 4 | Custom/User Defined | ✅ Supported | ✅ Supported | -| 5 | Multi-user (GUI Mode) / Halt *(err)* | ❌ (GUI Mode) | ❌ (Halt/Error?) | -| 6 | Reboot | ✅ Supported | ✅ Supported | - -> 💡 **Note**: -> -> * On **Red Hat**, runlevel 5 typically starts the system with a graphical user interface (GUI). -> * On **Debian**, runlevel 5 is often unused or reserved for custom setups. -> * Runlevel behavior can be customized depending on system configuration. - ---- - -## 🔧 Commands - -### Check Current Runlevel - -```bash -runlevel -``` - -### Change Runlevel - -```bash -telinit -``` - -or - -```bash -init -``` - -> ⚠️ Changing runlevels may stop or restart services. Use with caution, especially on production systems. - ---- - -## 📚 Additional Tips - -* Modern Linux systems (especially systemd-based) may not rely on traditional runlevels. Instead, they use *targets*. Example: - - ```bash - systemctl get-default - systemctl isolate graphical.target - ``` -