Ubuntu package management shortcuts from command line

Here are some of the more frequently used commands that I find useful.

To search for a particular package by name or description:
From the command-line, use:


apt-cache search keyword

The apt tool on Ubuntu 14.04 and above makes this very easy.


apt list --installed

Check available version of a package in Ubuntu repositories from command line:

apt-cache policy

You may wonder if the given package is installed or not. It’s easy to find out too.

In the above output, you see two words namely Installed and Candidate.

Installed : This will tell you the version that you have currently installed in your Ubuntu system.
Candidate : This is actual version that will be installed from the Ubuntu repositories when you install the package using apt-get.

If your system is in state where apt-get is mostly unusable you could try using dpkg to remove the affected package, in this case try:


sudo dpkg --purge php5-memcache

Leave a Reply

Your email address will not be published. Required fields are marked *