Get Installed Repositories on Ubuntu

Get Installed Repositories on Ubuntu

The APT is the package manager used on Ubuntu, responsible for handling software installation, updates, and removals. APT uses repositories (repos) as sources to fetch packages for installation. Obtaining a list of all installed repositories on Ubuntu is useful as it offers a clear overview of enabled software sources, ensuring users know the origins of their packages and have access to the latest updates and applications. This tutorial shows how to get installed repositories on Ubuntu.

To obtain a list of all installed repositories, you can use the following command:

sudo grep -rhE ^deb /etc/apt/sources.list*

Let's break down the command step by step:

  • grep - a command line tool for searching text patterns in files.
  • -r - option that informs to search for the pattern in directories and their subdirectories, effectively performing a recursive search.
  • -h - option that suppresses the display of file names in the output.
  • -E - option enables the use of extended regular expressions in the pattern. It allows you to use more advanced search patterns.
  • ^deb - the pattern that is used to search for lines that start with deb in the files.
  • /etc/apt/sources.list* - the file pattern that specifies where grep should look for the pattern. It uses a wildcard * to match all files starting with sources.list in the /etc/apt/ directory and its subdirectories.

Here's an example of the output you might see when running the command:

deb jammy main restricted
deb jammy-updates main restricted
deb jammy universe
deb jammy-updates universe
deb jammy multiverse
deb jammy-updates multiverse
deb jammy-backports main restricted universe multiverse
deb jammy-security main restricted
deb jammy-security universe
deb jammy-security multiverse

Leave a Comment

Cancel reply

Your email address will not be published.