If you are not new to Linux you probably have heard about apt (Advanced Packaging Tool) before.

It is used on Debian -based Linux distributions (such as, for example Ubuntu) and allows you to install, remove and update packages.

Here are a few examples on how to use the tool.

Updating your system using apt-get

On every newly installed Debian based Linux you want to run:

sudo apt-get update

This will synchronize the index of packages from the sources.

sudo apt-get upgrade

To upgrade the packages and system to the latest versions.

sudo apt-get dist-upgrade

To perform the full system upgrade and handle dependencies.

You can also run a one-liner:

sudo apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y

-y will answer “yes” to the question whether you want to proceed with update/upgrade.

Searching for packages and installing them

There is a command to search for packages called apt-cache. First you will need to update the repositories:

sudo apt-get update

Then you can search for the package that you need. In my example I am looking for workzeug addon for Python Flask.

apt-cache search python3 flask

I will then see a long list of packages that includes the one I am searching for:

python3-flask - micro web framework based on Werkzeug and Jinja2 - Python 3.x

Now I can install it using apt-get install:

sudo apt-get install python3-flask