apt
Install, update and remove software
What it does
apt is the package manager of Ubuntu and Debian. update downloads fresh package lists but installs nothing, so you run it before install and upgrade. upgrade updates everything installed, and install adds a package with its dependencies.
remove removes a package but keeps its settings, purge removes them too, and autoremove clears out dependencies nothing needs any more. apt search <word> looks for a package by name and description. Scripts use apt-get instead of apt, since its output stays stable.
Syntax
sudo apt update
sudo apt upgrade
sudo apt install <package>
sudo apt remove <package>Examples
Refresh the lists of available packages
sudo apt updatesame as:
sudo apt-get updateapt— the Ubuntu and Debian package managerupdate— download fresh lists; changes no packages
Install updates for every package
sudo apt upgradeapt— the package managerupgrade— update installed packages
Install nginx
sudo apt install nginxsame as:
sudo apt-get install nginxinstall— install a package with its dependenciesnginx— the package
Remove nginx but keep its settings
sudo apt remove nginxsame as:
sudo apt-get remove nginxremove— remove a package; settings stay (purge removes them too)nginx— the package