GET THE MOST OUT OF APT-GET

Debian uses Apt (Advanced Package Tool) as its package manager (a tool that assists you on resolving dependencies when you need to install, upgrade, configure, and remove packages).

Throughout 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 manager.

It all starts with update repositories

apt-get update

To update entire of system

apt-get upgrade

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 updates that package if it has already been 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 the 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 an application lacks the features you need. The solution is you need to install some more of its dependencies.

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]

dpkg

I find the dpkg is an essential command to supplement 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]

Leave a comment