How to Manage Packages on Ubuntu With Apt

Special tools were created for Linux application management. Application software is usually packaged for Linux. Apt-get is the standard package manager available on Ubuntu.

For many distributions, the recommended method of controlling software from the command line is using apt, a command line interface for the dpkg packaging system. In Debian and Linux distributions based on Debian, such as Ubuntu, it serves as the primary package management system.

A software utility called a package manager is used by Linux operating systems to ensure that the software is installed correctly and is up to date. Also, it maintains an up-to-date list of accessible software, which is kept outside in a database known as a repository.

This tutorial explains how to manage packages on Ubuntu using apt-get.

Required conditions

  • An operating system based on Linux
  • Possession of a command line or terminal
  • The pre-installed apt-get program in Linux systems based on Ubuntu and Debian
  • Since apt-get is a command-line tool, the Ubuntu terminal will be required.

Go to Applications > System Tools > Terminal from the system menu.

Alternatively, you can open Terminal using the Ctrl + Alt + T keys.

PRODUCTS THAT MIGHT INTEREST YOU:

Benefit from the best server plans and related services, competitive prices, coupled with personalized attention to each client. Supported by top-notch technical assistance that remains consistently accessible to address all your inquiries.

Use apt to update Ubuntu Package Repositories

Refreshing your local list of applications before installing a new one is a good practice.

To update your Ubuntu local software list, do the following commands in a terminal:

sudo apt-get update

Your system will search the repositories for the most recent data. When completed, the result indicates done.

Just a quick note: using the sudo command in Linux allows you to carry out operations with temporary administrator privileges. You may be prompted to provide your password.

Installing a Package using apt

One method for adding repositories is to install a software package called software-properties-common. This package allows you to use the add-apt-repository command in Ubuntu without encountering the common error “Add-Apt-Repository Command Not Found.”

Below is a step-by-step guide on installing a package using apt-get.

Enter the following command in your terminal window:

sudo apt-get install software-properties-common

The system will access the repositories, proceed to download, and then install the software. If you possess the most up-to-date edition, the output will inform you and display the present version.

After the process is finished, please input the following:

sudo add-apt-repository ppa:[repository_string]

Kindly substitute [repository_string] with the repository name you are adding. The name can typically be found on the software developer’s website.

After finishing that task, proceed with another update.

Updating installed software using apt

A useful feature of apt-get is its ability to efficiently check for and apply software updates to all packages simultaneously. Typically, this is taken care of automatically according to a set schedule.

If you prefer to manually scan and install updates, including those for your core operating system, you can execute the following command:

sudo apt-get upgrade

The system will establish a connection with the servers and initiate the download of any existing software updates. Be patient, as it might require a bit of time. Please be patient and wait for the process to finish.

Remove Package

The process for removing a package on Ubuntu is straightforward and hassle-free.

Please provide the following information:

sudo apt-get remove [package_name]

Substitute [package_name] with the name of your application’s system. Please ensure you thoroughly verify the name in case of any errors.

View the list of all packages By using the Package Manager

To view all the available packages on your Ubuntu system, simply execute the following command:

sudo apt list

Once more, you have the option to solely view the packages that have been installed. To accomplish this, execute the following command:

sudo apt list --installed

Find the package using the APT Package Manager.

This section will help you determine if the package you are considering is available in the Ubuntu repository, so you can avoid reinstalling it. Here, we need to install the nano text editor package. First, we execute the command to search in the repository.

$ sudo apt search nano

Use APT Package Manager to get package information.

Displaying the details of a package, such as its version, dependencies, and installed size, can be done using the APT package manager. As an example, let’s take a look at the details of the nano text editor:

$ sudo apt show nano

Installing packages using the APT package manager

Utilizing the APT Package Manager in Ubuntu grants you the ability to effortlessly install any package that is accessible in the default repository. As an illustration, the following command is utilized to install the nano package manager:

$ sudo apt install nano -y

Uninstalling packages with the APT Package Manager

To effectively utilize the APT Package Manager in Ubuntu, it is essential to familiarize oneself with the various commands outlined in this article. Mastering these commands will enable you to confidently execute them in relevant scenarios. By utilizing the command provided, you can effectively uninstall packages from Ubuntu. As an illustration, to uninstall the nano package, you can type:

$ sudo apt remove nano -y

To remove nano’s configuration files, use the following command; running the previous command will not delete them.

$ sudo apt purge nano -y

Seeking assistance with using APT on Ubuntu

If you want to see a comprehensive list of options along with their descriptions, just use the command provided below. It will guide you on how to access Help while using the APT package manager.

$ apt help

How to Install a .Deb Package Using the APT Package Manager

Here’s the command you can use to install a .deb file:

$ sudo apt deb atom-amd64.deb

Efficiently tidy up outdated repositories with the help of APT package manager

You can execute one of the following commands to remove or clean all old local repositories of the downloaded package files.

$ sudo apt autoclean 

Alternatively

$ sudo apt clean

Removing Unused Packages with APT Package Manager

When you install a new package on your system, its dependencies are installed alongside it. These dependencies utilize system libraries that are shared with other packages. The dependencies of that specific package will remain in the system even after it is removed. To remove them, simply type:

$ sudo apt autoremove

Confirm the installed package version using the APT package manager.

To check the installed package version, execute the following command:

$ sudo apt version chrome

Find and resolve broken dependencies of a package by using the APT package manager.

You may have encountered the issue of broken package dependencies. Here’s a command you can use to check for this issue. To accomplish this, input:

$ sudo apt check chrome

Provide a comprehensive list of all the dependencies associated with a package.

To examine the dependencies of your chosen package, utilize the following command to retrieve and display comprehensive information.

$ sudo apt depends chrome

Find the installed packages

Execute the following command to effortlessly locate the desired package. In addition, it provides a comprehensive list of all the files included in the package.

$ sudo apt content chrome

In a recap

Now you have a good understanding of package management on Ubuntu using apt. Mastering apt-get on Ubuntu equips you with efficient control over package management, ensuring your system is streamlined, up-to-date, and equipped with the necessary software. By employing apt-get, you enhance your Linux system’s performance and security, making it a vital skill for any tech-savvy Ubuntu user.

Package managers are an extremely useful tool for Linux users. They take care of the majority of the tedious tasks, ensuring that updates and dependencies are checked for you. By familiarizing yourself with apt-get, you can significantly enhance your level of control over your Linux installation.\

FAQs

Apt-get is a command-line tool used as the package management system in Ubuntu and other Debian-based Linux distributions. It allows users to install, update, and remove software packages.

To update your local software list, open your terminal and type sudo apt-get update. This command refreshes your system’s package list from its configured repositories.

To install a package, use the command sudo apt-get install [package_name], replacing [package_name] with the name of the software you want to install.

Install the software-properties-common package using sudo apt-get install software-properties-common. This package includes the add-apt-repository command, which is essential for adding new software repositories.

After installing software-properties-common, you can add a new repository by typing sudo add-apt-repository ppa:[repository_string], replacing [repository_string] with the specific repository you wish to add.

To upgrade all your system’s software to the latest versions available in the repositories, use sudo apt-get upgrade. This command downloads and applies updates for all packages currently installed.

To remove a package, type sudo apt-get remove [package_name], substituting [package_name] with the actual name of the software you wish to uninstall.

While both commands are used for handling packages, apt is the newer command that streamlines some functions and provides a more user-friendly output. It’s generally recommended to use apt for interactive improvements, while apt-get is used for backward compatibility and automation scripts.