diff --git a/Linux/LPIC1/3-package-managers.md b/Linux/LPIC1/3-package-managers.md index 88b7c2d..173d7ba 100644 --- a/Linux/LPIC1/3-package-managers.md +++ b/Linux/LPIC1/3-package-managers.md @@ -47,29 +47,3 @@ Created by external developers or organizations. Use with caution and verify tru ## 🌍 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/5-apt.md b/Linux/LPIC1/5-apt.md new file mode 100644 index 0000000..20fb4a7 --- /dev/null +++ b/Linux/LPIC1/5-apt.md @@ -0,0 +1,148 @@ +# 📦 Managing Packages with `apt` on Debian/Ubuntu + +The `apt` (Advanced Package Tool) command-line utility allows you to manage software on Debian-based Linux systems. Below are essential `apt` commands grouped by purpose, with clear explanations for each. + +--- + +## 🔄 1. Updating and Upgrading the System + +### `sudo apt update` + +Fetches the latest package lists from repositories. This ensures your system is aware of the newest available versions of packages. + +```bash +sudo apt update +``` + +--- + +### `apt upgrade` + +Installs the newest versions of all installed packages based on the updated package lists. It does **not** remove or install any other packages. + +```bash +apt upgrade +``` + +--- + +## 🔍 2. Searching and Viewing Packages + +### `apt show ` + +Displays detailed information about a specific package, including version, dependencies, description, and more. + +```bash +apt show +``` + +--- + +### `apt list` + +Lists packages based on various filters (e.g., installed, upgradable, available). Running it without arguments shows all packages. + +```bash +apt list +``` + +--- + +### `apt-cache search ` + +Searches the package cache for packages matching the given name or description. Useful for discovering packages related to a topic or function. + +```bash +apt-cache search +``` + +--- + +## 📥 3. Installing and Reinstalling Packages + +### `apt install ` + +Installs a package and its dependencies from the repositories. + +```bash +apt install +``` + +--- + +### `apt reinstall ` + +Reinstalls the specified package. This is useful if files from a package are accidentally deleted or corrupted. + +```bash +apt reinstall +``` + +--- + +## ❌ 4. Removing Packages + +### `apt remove ` + +Removes the specified package but **retains configuration files**. Useful when planning to reinstall later without losing settings. + +```bash +apt remove +``` + +--- + +### `apt purge ` + +Completely removes the package **along with its configuration files**. Use when you want a clean uninstallation. + +```bash +apt purge +``` + +--- + +### `apt autoremove` + +Automatically removes packages that were installed as dependencies but are no longer needed. + +```bash +apt autoremove +``` + +--- + +## 🛠️ 5. Advanced Package Handling + +### `apt install -f` + +Attempts to **fix broken dependencies** by installing missing packages. Often used after a failed install. + +```bash +apt install -f +``` + +--- + +### `apt install --download-only ` + +Downloads a package without installing it. The downloaded `.deb` files are saved in: + +```bash +/var/cache/apt/archives/ +``` + +Example: + +```bash +apt install --download-only +``` + +--- + +## ✅ Final Notes + +* Always start with `sudo apt update` before any install or upgrade. +* Use `apt-cache search` when unsure of a package’s exact name. +* Be cautious with `purge` as it deletes config files too. + diff --git a/Linux/LPIC1/6-yum.md b/Linux/LPIC1/6-yum.md new file mode 100644 index 0000000..e69de29