{"id":30680492,"url":"https://github.com/linuxutils/pactool","last_synced_at":"2025-09-01T16:05:06.355Z","repository":{"id":305089504,"uuid":"1021873924","full_name":"LinuxUtils/pactool","owner":"LinuxUtils","description":"A cross-distro package management helper for Linux systems.","archived":false,"fork":false,"pushed_at":"2025-07-23T15:53:23.000Z","size":3533,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T08:49:44.461Z","etag":null,"topics":["archlinux","bash","cli","command-line","command-line-tool","helper","linux","linux-utilities","open-source","optimization","package","package-manager","pacman","python","server","terminal","tools","ubuntu","zsh"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinuxUtils.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-18T04:57:16.000Z","updated_at":"2025-07-28T17:35:53.000Z","dependencies_parsed_at":"2025-07-18T09:49:46.512Z","dependency_job_id":null,"html_url":"https://github.com/LinuxUtils/pactool","commit_stats":null,"previous_names":["linuxutils/pactool"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/LinuxUtils/pactool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUtils%2Fpactool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUtils%2Fpactool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUtils%2Fpactool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUtils%2Fpactool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinuxUtils","download_url":"https://codeload.github.com/LinuxUtils/pactool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUtils%2Fpactool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273151417,"owners_count":25054410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["archlinux","bash","cli","command-line","command-line-tool","helper","linux","linux-utilities","open-source","optimization","package","package-manager","pacman","python","server","terminal","tools","ubuntu","zsh"],"created_at":"2025-09-01T16:05:04.930Z","updated_at":"2025-09-01T16:05:06.337Z","avatar_url":"https://github.com/LinuxUtils.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![PACTOOL BANNER](https://github.com/LinuxUtils/paktool/blob/main/graphics/PACTOOL_BANNER.png?raw=true)\n\n[![License: Apache 2](https://img.shields.io/badge/License-APACHE2-blue.svg)](https://github.com/LinuxUtils/pactool/blob/main/LICENSE)\n[![Latest Commit](https://img.shields.io/github/last-commit/LinuxUtils/pactool?color=blue\u0026label=Last%20Commit)](https://github.com/LinuxUtils/pactool/commits/main)\n[![Release](https://img.shields.io/github/v/release/LinuxUtils/pactool?color=green\u0026label=Latest%20Release)](https://github.com/LinuxUtils/pactool/releases)\n[![Issues](https://img.shields.io/github/issues/LinuxUtils/pactool?color=red\u0026label=Open%20Issues)](https://github.com/LinuxUtils/pactool/issues)\n[![Pull Requests](https://img.shields.io/github/issues-pr/LinuxUtils/pactool?label=Pull%20Requests)](https://github.com/LinuxUtils/pactool/pulls)\n[![Repo Size](https://img.shields.io/github/repo-size/LinuxUtils/pactool?label=Repo%20Size)](https://github.com/LinuxUtils/pactool)\n[![Code Size](https://img.shields.io/github/languages/code-size/LinuxUtils/pactool?label=Code%20Size)](https://github.com/LinuxUtils/pactool)\n[![Top Language](https://img.shields.io/github/languages/top/LinuxUtils/pactool?color=yellow)](https://github.com/LinuxUtils/pactool)\n[![Contributors](https://img.shields.io/github/contributors/LinuxUtils/pactool)](https://github.com/LinuxUtils/pactool/graphs/contributors)\n[![Forks](https://img.shields.io/github/forks/LinuxUtils/pactool?style=social)](https://github.com/LinuxUtils/pactool/network/members)\n[![Stars](https://img.shields.io/github/stars/LinuxUtils/pactool?style=social)](https://github.com/LinuxUtils/pactool/stargazers)\n[![Watchers](https://img.shields.io/github/watchers/LinuxUtils/pactool?style=social)](https://github.com/LinuxUtils/pactool/watchers)\n[![Downloads](https://img.shields.io/github/downloads/LinuxUtils/pactool/total?color=purple\u0026label=Downloads)](https://github.com/LinuxUtils/pactool/releases)\n[![Python Version](https://img.shields.io/badge/Python-3.8+-blue?logo=python)](https://www.python.org/)\n[![OS](https://img.shields.io/badge/Supported-Arch%20%7C%20Debian%20%7C%20Ubuntu-orange)](https://github.com/LinuxUtils/pactool)\n[![PyPI Version](https://img.shields.io/pypi/v/pactool-linuxutils?color=blue\u0026label=PyPI%20Version)](https://pypi.org/project/pactool-linuxutils/)\n\n\n# What is Pactool?\n#### Pactool is a versatile, simple, and powerful package management helper designed for **Arch Linux** and **Debian-based distributions**. It provides a clear and modern overview of all installed packages, their sizes, and dependencies, and offers various tools to optimize and maintain your system efficiently.\n\n---\n\n## **Features**\n- **Cross-distro support** for Arch Linux, Manjaro, Debian, Ubuntu, and other derivatives.\n- **Advanced package listing** with pagination, sorting (name, size, type), and filtering (user/system packages).\n- Full **search, install, uninstall, update, and upgrade** commands.\n- **Mirror management** with support for automatic backups and restores:\n  - Show current mirrors with latency checks and timestamps.\n  - Auto-update mirrors to the fastest available servers.\n  - Backup and revert mirrors using timestamped snapshots.\n- **Dependency \u0026 reverse dependency tree** analysis via `--why PACKAGE`.\n- **File ownership**: list all files installed by a package with `--files PACKAGE`.\n- **Cache cleaning** with safe prompts.\n- **Kernel utilities**:\n  - `--cleanup-kernels` for removing outdated kernels safely.\n  - `--backup-kernel` to backup the current kernel and initramfs.\n- **Color-coded, human-friendly output** for better readability.\n- Detailed **statistics** with `--stats` to understand package count, disk usage, and outdated software.\n- **Interactive confirmations** for critical actions like upgrades, removals, or mirror changes.\n\n---\n\n## **Installation \u0026 Setup**\n\n### Run Directly\n```bash\npython3 pactool.py --help\n```\n\n### Add Pactool to PATH (Global Install)\n```bash\nsudo cp pactool.py /usr/local/bin/pactool\nsudo chmod +x /usr/local/bin/pactool\n```\n\n### Requirements\n- **Python 3.8+**\n- `reflector` (Arch Linux) or `netselect-apt` (Debian/Ubuntu) for mirror management.\n- Core package manager tools (`dpkg`, `apt`, or `pacman`) depending on your distro.\n- `sudo` permissions for kernel or mirror-related operations.\n\n---\n\n## **Basic Usage**\n```bash\npython3 pactool.py [COMMANDS] [OPTIONS]\n```\n\n### **Examples**\n```bash\n# Show all installed packages\npython3 pactool.py --list\n\n# Show only 20 packages\npython3 pactool.py --list -n 20\n\n# Search for 'firefox'\npython3 pactool.py --search firefox\n\n# Install VLC\npython3 pactool.py --install vlc\n\n# Uninstall VLC\npython3 pactool.py --uninstall vlc\n\n# Update all packages\npython3 pactool.py --update\n\n# Upgrade system\npython3 pactool.py --upgrade\n```\n\n---\n\n## **Package Management**\n\n### **List Packages**\nDisplay installed packages with pagination and sorting:\n```bash\npython3 pactool.py --list -n 30\n```\nSort by name:\n```bash\npython3 pactool.py --list --sort name\n```\nReverse sort by size:\n```bash\npython3 pactool.py --list --rsort size\n```\n\n### **Search Packages**\n```bash\npython3 pactool.py --search vlc\n```\n\n### **Show Package Info**\n```bash\npython3 pactool.py --info vlc\n```\n\n### **Check for Outdated Packages**\n```bash\npython3 pactool.py --outdated\n```\n\n---\n\n## **Mirror Management**\n\n### **Show Current Mirrors**\nDisplays active mirrors with **response time** and **last updated**:\n```bash\npython3 pactool.py --show-mirrors\n```\n**Sample Output:**\n```\n[✔]  https://mirror.osbeck.com/archlinux/$repo/os/$arch         124.42 ms    (Last Updated: Fri, 18 Jul 2025 14:38:24 GMT)\n[✔]  https://mirror.cyberbits.eu/archlinux/$repo/os/$arch       738.60 ms    (Last Updated: Fri, 18 Jul 2025 13:30:26 GMT)\n[✔]  https://mirror.ubrco.de/archlinux/$repo/os/$arch           949.06 ms    (Last Updated: N/A)\n```\n\n### **Update to Fastest Mirrors**\n```bash\npython3 pactool.py --update-mirrors\n```\n\n### **Backup Mirrors**\n```bash\npython3 pactool.py --backup-mirrors\n```\nBackups stored in:\n```\n~/.cache/pactool/mirrors/\n```\n\n### **Revert Mirrors**\n```bash\npython3 pactool.py --revert-mirrors\n```\n**Example:**\n```\nAvailable backups:\n(1) Friday, 18 July 2025 at 05:42:54\n(2) Friday, 18 July 2025 at 05:44:15\n\nWhich backup would you like? (ID) \u003e 2\nReverted mirrors to 2025-07-18_05-44-15\n```\n\n---\n\n## **Kernel Management**\nPactool simplifies kernel management on Arch and Debian systems.\n\n### **Cleanup Old Kernels**\n```bash\npython3 pactool.py --cleanup-kernels\n```\nThis removes outdated kernels while keeping the current version intact.\n\n### **Backup Current Kernel**\n```bash\npython3 pactool.py --backup-kernel\n```\nBacks up `vmlinuz`, `initramfs`, and optionally `System.map` to:\n```\n/boot/pactool/backup/\n```\n\n---\n\n## **Advanced Commands**\n\n### **Reverse Dependency Tree**\n```bash\npython3 pactool.py --why firefox\n```\n**Output:**\n```\nReverse dependency tree for 'firefox':\n\nfirefox\n  └─ gnome-browser\n    └─ gnome-desktop\n```\n\n### **List Files Installed by a Package**\n```bash\npython3 pactool.py --files vlc\n```\n**Example:**\n```\nFiles installed by 'vlc':\n    /usr/bin/vlc\n    /usr/share/applications/vlc.desktop\n    /usr/share/icons/hicolor/48x48/apps/vlc.png\n```\n\n### **Clean Cache**\n```bash\npython3 pactool.py --clean\n```\nCleans package cache and prompts before deleting.\n\n\n\n## **Security Management**\n\nPactool offers built-in tools to manage and check for security vulnerabilities.\n\n### **View Security Packages**\nCheck for installed security-related packages on Debian/Ubuntu or run a security audit on Arch Linux:\n```bash\npython3 pactool.py --view-security-packages\n```\n**Debian/Ubuntu Example Output:**\n```\nSecurity Packages Installed (Debian/Ubuntu):\nlibssl1.1\nlibgnutls30\n```\n**Arch Linux Example Output:**\n```\ngrub        [High Risk]    Affected by multiple issues.\nlibxml2     [High Risk]    Affected by denial of service.\n```\nPackages are **color-coded**:\n- **Blue**: System packages.\n- **Magenta**: User-installed packages.\n\n### **Upgrade Security Packages**\nOn Debian/Ubuntu systems, upgrade only security-related packages:\n```bash\npython3 pactool.py --upgrade-security\n```\nThis ensures only security-related updates are applied.\n\n### **Check Security Vulnerabilities**\nYou can run a vulnerability check for any package using:\n```bash\npython3 pactool.py --vuln-check PACKAGE\n```\nExample:\n```\npython3 pactool.py --vuln-check openssl\n```\nThis will list all known CVEs, paginate results, and allow keyword searching within CVEs.\n\\\n\\\nYou can also perform a deep search on a package\n```\npython3 pactool.py --vuln-check feh --deep-search\n```\n\n\n## Deep‑Dive Commands: `--history` \u0026 `--versions`\nThese two commands for very useful for tracking package vulnerabilities on your Linux system.  \nThey are optional, safe‑to‑run, **read‑only** operations – nothing is modified on disk.\n\n---\n\n### `--history PACKAGE` — Time‑Travel Through Install \u0026 Upgrade Events\n| What it does | Why it matters |\n|--------------|----------------|\n| **Parses native logs** (`/var/log/pacman.log` on Arch/Manjaro, `apt` history on Debian/Ubuntu). | No additional services or daemons required.  |\n| **Groups each event** → _Installed / Upgraded_  | Instantly see when \u0026 why a package changed. |\n| **Extracts the exact command** that triggered the change. | Answers *“Which script or user action installed this?”* |\n| **Builds a tree** of version transitions  (`3.10.3‑1 → 3.11.0‑2`). | Visual diff of how you arrived at the current release. |\n| **Colour‑codes** user vs system packages. | Glance‑level ownership info. |\n| **Respects `Ctrl +C`** — quits instantly, no messy tracebacks. | Friendly CLI UX. |\n\n#### Example\n```bash\npactool --history bash\n```\n```\nPackage Version History for 'bash':\n\n    Installed bash (5.2.037‑1)              on 15 Feb 2025, 06:43 AM UTC\n     Upgraded bash (5.2.037‑1 → 5.2.037‑2)  on 14 Mar 2025, 10:49 AM UTC+03:00\n     Upgraded bash (5.2.037‑2 → 5.2.037‑3)  on 07 May 2025, 09:53 AM UTC+03:00\n     Upgraded bash (5.2.037‑3 → 5.2.037‑5)  on 10 May 2025, 02:33 AM UTC+03:00\n     Upgraded bash (5.2.037‑5 → 5.3.0‑1)    on 14 Jul 2025, 12:47 AM UTC+03:00\n\n    Command used:\n        pacman -Syu bash\n\n    Version Tree:\n        ├─ 5.2.037‑1\n        ├─ 5.2.037‑1 → 5.2.037‑2\n        ├─ 5.2.037‑2 → 5.2.037‑3\n        ├─ 5.2.037‑3 → 5.2.037‑5\n        └─ 5.2.037‑5 → 5.3.0‑1 (current)\n```\n**Tips**\n* Pipe to `less -R` to keep colours while scrolling.\n* Combine with `grep` to find a specific date:  \n  `pactool --history openssl | grep 2025‑04`\n\n---\n\n### `--versions PACKAGE` — Repo‑Wide Version Explorer\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eQuick glance\u003c/strong\u003e\u003c/summary\u003e\n\n| Mode | Purpose |\n|------|---------|\n| **Plain** (`--versions pkg`) | Fast list – shows every build string available in enabled repositories. |\n| **Risk mode** (`--versions pkg --assess-risk`) | Queries the **NVD API** live, counts CVEs per version, colour‑codes severity, shows a spinner while fetching. |\n\n\u003c/details\u003e\n\n#### Why you’ll love it\n* **Upgrade forecasting** – see what you’ll get _before_ hitting `pacman -Syu`.\n* **Rollback clarity** – pick an earlier safe build if the latest has many CVEs.\n* **Security snapshot** – Low/Medium/High risk label + exact CVE count.\n\n#### Example – quick scan\n```bash\npactool --versions python\n```\n```\n    ├─ 3.12.6‑2\n    ├─ 3.12.6‑3\n    └─ 3.13.0‑1  (current)\n```\n\n#### Example – full risk audit\n```bash\npactool --versions python --assess-risk\n```\n```\nAssessing risk for 'python' [\\]\nAvailable Versions for 'python':\n\n    ├─ 3.12.6‑2  [LOW RISK]     0 CVEs\n    ├─ 3.12.6‑3  [MEDIUM RISK]  4 CVEs\n    └─ 3.13.0‑1  [HIGH RISK]    7 CVEs  (current)\n```\n\n**How the risk score works**\n\n| CVE Count | Label | Typical action |\n|-----------|----------------|----------------|\n| 0 | **LOW RISK** | Safe to use / keep. |\n| 1 – 5 | **MEDIUM RISK** | Read CVE details; upgrade soon. |\n| \u003e 5 | **HIGH RISK** | Patch or pin a safer version ASAP (or get exploited, idc either way). |\n\n\u003e NVD API is rate‑limited (5 req / 30 s). Pactool caches results per session to avoid throttling.\n\n\n---\n\n### Some really useful combinations\n| Goal | Command |\n|------|---------|\n| Audit all install events **and** fetch CVEs for each version | `pactool --history openssl \u0026\u0026 pactool --versions openssl --assess-risk` |\n| Show only available versions newer than installed | `pactool --versions vim \\| awk '$1 \u003e \"9.0.0\"'` |\n| Continuous monitoring (cron) | `pactool --versions kernel --assess-risk \u003e\u003e /var/log/kernel-risk.log` |\n\n---\n\n## **Command Overview**\n```\nGENERAL COMMANDS:\n  --version                   Show Pactool version and exit\n  --about                     Display detailed information about Pactool\n\nPACKAGE COMMANDS:\n  --list                      List installed packages (paged by default)\n  -n N                        Number of packages to show (0 = all)\n  --stats                     Show statistics about packages\n  --files PACKAGE             List all files installed by a package\n  --search SEARCH             Search for a package by name\n  --why PACKAGE               Show reverse dependencies of a package\n  --uninstall PACKAGE         Uninstall a package by name\n  --install PACKAGE           Install a package by name\n  --update                    Update all installed packages\n  --upgrade                   Upgrade all installed packages\n  --clean                     Clean cached or unused package files\n  --sort CRITERIA             name/size/install-date/update-date/type\n  --rsort CRITERIA            Reverse sort by the same criteria\n  --user                      Show only user-installed packages\n  --system                    Show only system packages\n  --info PACKAGE              Show detailed information about a package\n  --bloat                     Find unused optional dependencies (bloat)\n  --unused                    Find unused or orphaned packages\n  --outdated                  List all outdated packages\n  --history PACKAGE           Show version history and updates of a package\n  --versions PACKAGE          Show all available versions of a package with risk levels\n\nSERVICE COMMANDS:\n  --services                  Show status of services related to packages\n  --service-info SERVICE      Show detailed info about a service\n  --service-logs SERVICE      Show logs of a service\n\nMIRROR COMMANDS:\n  --show-mirrors              Show current mirrors with ping \u0026 last update\n  --update-mirrors            Update to fastest mirrors\n  --revert-mirrors            Revert mirrors to previous backup\n  --backup-mirrors            Create a manual backup of the current mirror list\n\nKERNEL COMMANDS:\n  --cleanup-kernels           Automatically remove old kernels\n  --backup-kernel             Backup the current running kernel to /boot/pactool/backup\n\nSECURITY COMMANDS:\n  --upgrade-security          Upgrade only security-related packages (Debian/Ubuntu)\n  --vuln-check PACKAGE        Check known CVEs (vulnerabilities) for a package\n  --deep-search               Use with --vuln-check for detailed exploit tree and history\n  --view-security-packages    View all installed security packages with details\n```\n\n---\n\n## **Tips and Tricks**\n- Use `--user` to list only user-installed packages.\n- Combine `--list` with `--sort` for quick overviews of package size and type.\n- Backup mirrors before performing major upgrades.\n- Use `--why` to track down unnecessary package dependencies.\n- Create a shell alias:\n```bash\nalias pt='python3 /path/to/pactool.py'\n```\n\n---\n\n## **Troubleshooting**\n**Q:** Pactool says `reflector` is missing.  \n**A:** Install it with:\n```bash\nsudo pacman -S reflector\n```\nFor Debian-based systems, use:\n```bash\nsudo apt install netselect-apt\n```\n\n**Q:** Permission errors on mirror updates?  \n**A:** Run with `sudo` or `sudo -E`.\n\n**Q:** Kernel backup fails with missing `vmlinuz`?  \n**A:** Ensure the kernel image path matches `/boot/vmlinuz-*`. Adjust `kernals.py` if needed.\n\n---\n\n## **Contributing**\nWe welcome contributions from developers, testers, and Linux enthusiasts. Steps:\n1. Fork this repository.\n2. Create a feature branch.\n3. Commit your changes.\n4. Submit a Pull Request.\n\n**Ideas for contributions:**\n- Add support for other package managers (e.g., zypper, dnf).\n- Improve mirror ranking algorithms.\n- Write tests for advanced features.\n\n---\n\n## **License**\nCopyright 2025 LinuxUtils\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at:\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n[View License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxutils%2Fpactool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxutils%2Fpactool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxutils%2Fpactool/lists"}