APT (Advanced Package Tool) is a powerful command-line tool used to manage software packages on Debian-based systems like Ubuntu. Whether you're a beginner or a seasoned Linux user, mastering apt can significantly streamline your workflow.
This guide will walk you through the most essential APT commands to add, remove, and update software on Debian and Ubuntu.
APT is a command-line interface for managing .deb packages. It handles the installation, updating, upgrading, and removal of software on your system by fetching information from configured software repositories.
To install software using apt, use the following command:
bash
CopyEdit
sudo apt install <package-name>
bash
CopyEdit
sudo apt install vlc
This command installs the VLC media player. APT will automatically download the package and its dependencies from the repositories.
Tip: You can install multiple packages at once:
bash
CopyEdit
sudo apt install git curl htop
To uninstall a package from your system:
bash
CopyEdit
sudo apt remove <package-name>
bash
CopyEdit
sudo apt remove vlc
This removes the VLC application but keeps the configuration files.
To remove both the package and its configuration files:
bash
CopyEdit
sudo apt purge <package-name>
Use purge when you want to completely erase traces of a program.
Before installing or updating any package, it’s good practice to refresh the package index:
bash
CopyEdit
sudo apt update
This command pulls the latest package listings from all configured repositories, ensuring you're getting the most up-to-date software.
To upgrade your installed packages to their latest versions:
bash
CopyEdit
sudo apt upgrade
This will apply the latest versions of software, keeping your system secure and stable.
Security Tip: Run this regularly to apply security patches and feature updates.
To perform a more comprehensive upgrade that includes package removals and additions:
bash
CopyEdit
sudo apt full-upgrade
This command is useful when you need to upgrade between major OS versions or handle large dependency changes.
When you remove software, some dependencies may linger. Use this command to clean them up:
bash
CopyEdit
sudo apt autoremove
This removes unused libraries and packages no longer needed by any installed software.
To learn more about a specific package:
bash
CopyEdit
apt show <package-name>
This command provides detailed information like the version, dependencies, maintainer, and a short description.
Looking for a package but don’t know the exact name? Use:
bash
CopyEdit
apt search <keyword>
bash
CopyEdit
apt search image editor
Update repo index:
sudo apt update
Install software:
sudo apt install <package-name>
Remove software:
sudo apt remove <package-name>
Purge software:
sudo apt purge <package-name>
Upgrade packages:
sudo apt upgrade
Full upgrade:
sudo apt full-upgrade
Autoremove unused:
sudo apt autoremove
Show package info:
apt show <package-name>
Search for package:
apt search <keyword>
Be cautious with full-upgrade, especially on production systems, as it may remove some packages.
If you’re still having trouble, consider reaching out to Support.Com for a personalized solution to all technical support issues.