Back to course

68. Using `apt`: Updating, Installing, and Removing Software

Linux Basics: From Zero to CLI Hero

Essential APT Commands

All package management commands require sudo privileges.

1. Update the Local Package Index (apt update)

This command fetches the latest information about available packages from the repositories. It does not install or upgrade any software.

bash $ sudo apt update

2. Installing Packages (apt install)

Downloads and installs the package and any required dependencies.

bash $ sudo apt install apache2

Installs the Apache web server

3. Upgrading Software (apt upgrade)

Upgrades all currently installed packages to their latest versions based on the updated index.

bash $ sudo apt upgrade

4. Removing Software (apt remove)

Removes the package binaries but leaves configuration files behind.

bash $ sudo apt remove apache2

5. Purging Software (apt purge)

Removes the package and all associated configuration files.

bash $ sudo apt purge apache2