Skip to content

Usage Examples

Lokesh Kumar edited this page Aug 7, 2026 · 1 revision

Usage Examples

pkgwrap is designed to be completely invisible once you build the muscle memory for it. Below are some real-world scenarios showing how to leverage pkgwrap and its alias pkw in your daily workflow.


Scenario 1: Setting up a fresh VPS

When you spin up a brand new Debian, Ubuntu, or Fedora server, you usually need to update the system and grab some essential utilities. pkgwrap automatically detects the right backend (like apt or dnf) and handles the privilege escalation for you.

# Automatically runs `apt update` && `apt upgrade -y` (or dnf equivalents)
pkw update

# Install essential server tools in one go
pkw install curl git htop vim tmux ufw

Scenario 2: Installing Dev Tools on Termux

If you code on the go using an Android device, Termux is fantastic. However, Termux uses pkg and doesn't use sudo. pkgwrap knows this and seamlessly drops the sudo requirements.

# Ensure repository index is fresh
pkw update

# Grab a mobile dev stack
pkw install nodejs python neovim openssh

Scenario 3: Automation in Shell Scripts

If you are writing a setup script (dotfiles, CI/CD pipelines, or bootstrapping), you don't want interactive prompts stalling your execution. Use the -y or --yes flag to automatically agree to sudo escalations and package manager prompts.

#!/bin/bash
echo "Bootstrapping developer environment..."

# The -y flag ensures 'apt install -y docker.io' is run silently without prompting
pkw install docker.io -y
pkw install docker-compose -y

echo "Done!"

Scenario 4: Checking the Active Backend

If you're debugging or writing a complex wrapper script and need to know exactly which package manager pkgwrap thinks is in control of your system, use the --backend flag. It will print the identifier and exit.

# On an Arch Linux machine:
$ pkgwrap --backend
ℹ Active backend detected: pacman

# On macOS:
$ pkgwrap --backend
ℹ Active backend detected: brew

Clone this wiki locally