apt: command not found

The Advanced Package Tool (APT) is a command-line tool used to interact easily with the dpkg packaging system. APT is the ideal method used for managing software within Debian-based Linux distributions, such as Ubuntu. It manages dependencies effectively, maintains large configuration files, and properly handles upgrades and downgrades to ensure system stability. On its own, dpkg does not handle dependencies properly.

In Debian/Ubuntu-based distributions, software management is done via the apt utility, which is a recent replacement for the utilities apt-get and apt-cache. The most-used commands include:

Command Description
apt list List packages
apt search Search in descriptions
apt install Install a package
apt show Show package details
apt remove Remove a package
apt update Update catalog of available packages
apt upgrade Upgrade the installed software
apt edit-sources Edit the repository configuration

If you encounter below error while running the apt command:

apt: command not found

you may try installing the apt package as per your choice of distribution.

Distribution Command
Debian apt-get install apt
Ubuntu apt-get install apt
Arch Linux pacman -S apt
Kali Linux apt-get install apt
CentOS yum install apt
Fedora dnf install apt
Raspbian apt-get install apt

apt Command Examples

1. Update the list of available packages and versions (it’s recommended to run this before other `apt` commands):

$ sudo apt update

2. Search for a given package:

$ apt search package

3. Show information for a package:

$ apt show package

4. Install a package, or update it to the latest available version:

$ sudo apt install package

5. Remove a package (using `purge` instead also removes its configuration files):

$ sudo apt remove package

6. Upgrade all installed packages to their newest available versions:

$ sudo apt upgrade

7. List all packages:

$ apt list

8. List installed packages:

$ apt list --installed
Related Post