Installing and Removing Packages
Install a package
sudo apt install htop
sudo apt install htop tree curl # Multiple at once
sudo apt install -y htop # Auto-confirm prompts
Remove a package
sudo apt remove htop # Removes the program, keeps config files
sudo apt purge htop # Removes the program AND its config files
Clean up leftover dependencies
sudo apt autoremove # Removes packages that were only installed as dependencies and are no longer needed
sudo apt autoclean # Clears out old downloaded .deb files from cache
Reinstall a package
sudo apt install --reinstall htop
Pin / hold a package version
sudo apt-mark hold htop # Prevent htop from being upgraded
sudo apt-mark unhold htop
Typical workflow
sudo apt update
sudo apt install nginx
sudo apt remove --purge htop
sudo apt autoremove