Back to course

The pkg Command: Search, Install, Remove

Termux Masterclass: From Zero to Linux Power User on Android

16. The pkg Command: Search, Install, Remove

pkg is Termux's package manager, based on the highly reliable apt system used in Debian/Ubuntu.

1. Searching for Packages (pkg search)

If you need a tool but aren't sure of its exact package name, use search.

bash

Search for packages related to 'database'

$ pkg search database

2. Installing Software (pkg install)

Once you know the package name (e.g., python), use pkg install.

bash

Install Python

$ pkg install python

Install multiple packages at once

$ pkg install git nano

During installation, Termux checks dependencies and asks for confirmation (Y/n).

3. Removing Software (pkg uninstall or pkg remove)

If you no longer need a package, you can remove it.

bash

Remove the 'ruby' package

$ pkg uninstall ruby

4. Viewing Package Information (pkg show)

To see details about an installed package (version, dependencies, description):

bash $ pkg show python

Recap of Essential pkg Commands:

CommandPurpose
pkg updateRefresh package lists.
pkg upgradeUpgrade installed packages.
pkg install [package]Install a package.
pkg uninstall [package]Remove a package.
pkg search [keyword]Find a package.
pkg show [package]View package details.