Apt is a command line utility for install, update, remove and other operations. It manage dep packages in Ubuntu, Debian and distributions that based on it. It consists of most used commands apt-get and apt-cache but differs the default options. Apt was created for interactive use. Most of the commands of apt utility should be executed with sudo premissions.
Update package index
APT package indexes is the simple database which consist of the available packages records for your OS. You should update packages every time before installing or updating soft.
$ sudo apt update
Upgrade package index
Regular OS updates is the important case in system defence.
$ sudo apt upgrade
This command won't upgrade the packages which has the previous version that should be uninstalled manually.
For upgrading custom package type this command, don't forget to change package_name:
$ sudo apt upgrade package_name
Full system upgrade
The difference between upgrade and full-upgrade is that the last will delete installed package on system upgrade.
$ sudo apt full-upgrade
Install one package:
$ sudo apt install package_name
To install the bunch of packages use the space as delimiter:
$ sudo apt install package1 package2
To install local deb package:
$ sudo apt install /path/to/file.deb
$ sudo apt remove package_name
Remove multiple packages at once, use space for delimiter:
$ sudo apt remove package1 package2
Remove command will delete the package, but some config files will left on your storage device. If you want to remove config files for package too, use purge option:
$ sudo apt purge package_name
Remove unused packages
On new package installation it's dependencies will be installed too. But on package remove dependencies will left. Use autoremove command to remove unused packages:
$ sudo apt autoremove
List of available packages:
$ sudo apt list
Print the information about package:
$ sudo apt list | grep package_name
Print information about installed pacakges:
$ sudo apt list --installed
Print installed packages that could be updated:
$ sudo apt list --upgradeable
Search command will print the list of packages matched your search word.
$ sudo apt search package_name
Information about package dependencies, size of install bundle, source etc:
$ sudo apt show package_name