apt-get : Tips, tricks and usage guide

apt-get : Tips, tricks and usage guide

We all use apt-get every day but we are not aware of all of its capability. So I am creating a small cheat sheet to get handy with apt-get.

Update package database.

apt-get update

Search for package

apt-cache search package

Search for a package starting with a name

apt-cache pkgnames package

Show package information

apt-cache show package

Search for package version and all dependencies

apt-cache showpkg package

Install a package

apt-get install package name

Install a specific version of a package

apt-get install package=version

Update all package to the newest version as per repo database

 apt-get upgrade

Update specific package to the newest version as per repo database but no dependencies will be updated

 apt-get upgrade package

Update all package while updating the dependency package also

 apt-get dist-upgrade

Download source code of a package

apt-get --download-only source package-name

Download a package without installing it

apt-get download package-name

Uninstall a package – only relevant library files

 apt-get remove

Remove a package including data and configuration files also

 apt-get purge

Uninstall a package and all dependencies that are no longer required

 apt-get autoremove

Clear all cache from apt-get local database

 apt-get clean

Pin a version so that apt-get upgrade does not update that package


Package: yourpackage
Pin: version 7.*
Pin-Priority: 999

Leave a Reply

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