Copied to clipboard

apt

apt is a command-line tool used to manage software packages on Debian and Ubuntu systems, including installation, updating, and removal operations.

Install Package

Remove Package

Reinstall Package

Update Package

Search Package

List Package

Leave blank to list all packages

Show Package Details

Download Package from Software Source but Do Not Install

Example

  • Install a new package:

    sudo apt install <package_name>
    
  • Remove an installed package:

    sudo apt remove <package_name>
    
  • Update installed packages:

    sudo apt update
    sudo apt upgrade
    

    Note that before running the apt upgrade command, you should run the apt update command to update the list of packages. In addition, although software upgrades are usually safe, sometimes new versions may introduce incompatibilities or other issues, so it is best to ensure that your system and applications are backed up before upgrading, and to be cautious about upgrades in production environments.

  • Search for a package:

    apt search <keyword>
    
  • Display installed packages:

    apt list --installed
    
  • Display package details:

    apt show <package_name>
    
  • Download a package from the software source but do not install it:

    apt download <package_name>
    
  • Display upgradable packages:

    apt list --upgradable
    
  • Automatically remove packages that are no longer needed: sudo apt autoremove. Note that although apt autoremove is usually safe, when deleting packages, always carefully review the list of packages to be deleted to ensure that important software or system components are not accidentally deleted. If you are not sure whether a package can be safely removed, it is best to do some research or consult relevant personnel first.