pkg
pkg [-h] [-i|-u] <package> [package...]Installs or removes packages using the system’s available package manager. Supports paru, yay, pacman, apt, dnf, zypper, yum, brew, and pkg. In auto mode (no flag), detects whether each package is installed and toggles it — installing if absent, removing if present.
The package-installed check uses the correct query for each manager:
pacman/paru/yay |
pacman -Qi |
apt |
dpkg -s |
dnf/zypper/yum |
rpm -q |
brew |
brew list |
pkg |
pkg info |
Arguments:
-h, --help |
Show help message |
-i, --install |
Force install mode |
-u, --uninstall |
Force uninstall mode |
package |
One or more package names to install or remove |
Returns:
0 |
Operation completed |
1 |
No supported package manager found, unknown flag, or package operation failed |
pkg firefoxpkg -i ripgrep fd-findpkg -u cowsay