Debian uses Apt (Advanced Package Tool) as its package manager (a tool that assist you on resolving dependencies when you need to install, upgrade, configure, and remove packages).
Through out this guide, we had used the command apt-get install. In this lesson, I will show you how to get the most out of Apt package manger.
It all starts with update repositories
To update entire of system
Although named “upgrade”, the command is only for update packages that are already installed in your system.
To install and update a package
apt-get install [package name]
The command also update that package if it has already installed.
To install a package without its recommends
This is often the case of installing a minimal Ubuntu/Debian desktop.
To do that you need to specify this flag: –no-install-recommends
apt-get install --no-install-recommends [package name]
To remove a package
apt-get remove [package name]
To remove a package along with all of its configuration file:
apt-get --purge remove [package name]
To find information about installed or can be installed packages
apt-cache search [package name/ related word]
For instance, you can search for the key word “image viewer” to find all the info about image viewer in repositories.
apt-cache search “image viewer”
The output should be the list of packages that are related to image viewer.
To list dependencies and recommends of a packages
It’s very useful when you are trying to install a minimal Ubuntu system (mostly by using the ”–no-install-recommends” flag). Sometimes you will get yourself into a difficult situation where a application lacks the feature you need (the solution is you need to installs some more of it recommends).
apt-cache depends [package name]
To show the version of a package and which repository it is come from
apt-cache policy [package-name]
To find out about information about a package
apt-cache show [package-name]
I find the dpkg is a essential command to supplement to apt features.
dpkg -s [package name]
The command is equivalent to apt-cache show/policy.
To find if a package is installed on your system
dpkg -l [package-name]