Skip to main content

APT Package Manager Guide

The purpose of this guide is to explain how to use APT (Advanced Package Tool), a package manager for Debian-based distributions, to install, update, and manage software packages.

1. Update the package list

Before installing or updating software, update the local package list to ensure you have the latest information:

sudo apt update

2. Install software packages

To install a software package, use the apt install command followed by the package name.

sudo apt install <package-name>

For example, to install the htop package:

sudo apt install htop

3. Run applications

Using the GUI:

You can run applications using the GUI. After installing package using above command, it should appear in app drawer. You can access the app drawer by sliding up on the homescreen.

Using the Command:

If you want to run an application from the command line, you can do so by typing the application name in the terminal.

4. Remove software packages

To remove a software package, use the apt remove command followed by the package name.

sudo apt remove <package-name>

For example, to remove the htop package:

sudo apt remove htop

To remove a package along with its configuration files, use the apt purge command:

sudo apt purge <package-name>

For example, to purge the htop package:

sudo apt purge htop

5. Upgrade installed packages

To upgrade all installed packages to their latest versions, use the apt upgrade command:

sudo apt upgrade

6. Search for software packages

You can search for software packages using the apt search command followed by a keyword.

apt search <package-name>

For example, to search for packages related to Python:

apt search python

7. List installed packages

To list all installed packages on your system, use the apt list --installed command:

apt list --installed

8. Clean up package cache

To free up disk space by removing downloaded package files that are no longer needed, use the apt clean command:

sudo apt clean

9. Autoremove unused packages

To remove packages that were automatically installed to satisfy dependencies for other packages but are no longer needed, use the apt autoremove command:

sudo apt autoremove

10. Check package dependencies

To check the dependencies of a package before installing it, use the apt depends command followed by the package name.

apt depends <package-name>

For example, to check the dependencies of the htop package:

apt depends htop

11. Troubleshooting

If you encounter any issues while using APT, Here are some common issues and their solutions:

  • Package not found: If you get an error saying the package is not found, make sure you have the correct package name and that the package is available in the repositories.
  • Dependency issues: If you encounter dependency issues, try running sudo apt install -f to fix broken dependencies.
  • Connection issues: If you have connection issues, check your internet connection and try running sudo apt update to refresh the package list.

If you still encounter any issues while using APT, you can refer to the APT documentation.