Always refresh the local package index before installing software:
sudo apt update
Install a package:
sudo apt install nginx
Upgrade all installed packages to their latest versions:
sudo apt upgrade
Remove a package (keep config files) or purge it completely:
sudo apt remove nginx # uninstall but keep config
sudo apt purge nginx # uninstall and remove config
sudo apt autoremove # clean up orphaned dependencies
Search for a package and inspect it before installing:
apt search web server
apt show nginx
To list all installed packages or check whether a specific one is installed:
apt list --installed
dpkg -l | grep nginx