Top 3 Ubuntu Command Line Package Manager Tools


Ubuntu package managers on the command line help us install and remove packages, add or remove repositories, update installed apps, search for packages, etc.

What is a package manager?

A package manager is a tool that automates the process of managing (installing, updating, configuring, and removing) computer programs on operating systems.

While we can use Ubuntu’s GUI Package Manager, which is its software manager app, there are many programs that are only available through the command line or in the third-party repository. Besides using Ubuntu’s default package manager, such as APT in the GUI, there are a lot of powerful features that are easy to use in Terminal.

Ubuntu always uses APT (Advanced Packaging Tool) or dpkg for package management. This means that the software can be installed and uninstalled reliably in packages. Event the GUI software manager on Ubuntu uses APT. And due to its popularity among desktops and servers compared to other Linux distributions, there is a huge collection of programs available, such as additional software, applications, and drivers that can be installed using a few orders.

However, here we will discuss not only APT but also other package managers, for example SNAP which is another option in Ubuntu since 2014 to install software alongside normal package management without conflicts. All system and desktop owned packages are always installed (exclusively) through apt.

Ubuntu package managers available to use on the command line

APT – Advanced Wrapping Tool

APT is the default management system that was developed for Debian, as Ubuntu and other similar operating systems based on it therefore all use APT.

We can use APT to search for program packages to install them or update the whole system. It is not limited to that, a variety of tasks can be performed using it, and here are some common examples of using the Ubuntu APT Package Manager at the command line.

apt-get – package and source management

In older systems like Ubuntu 20.04, the apt has been used with to have, however, in the latest version we don’t need to use it to download and install various packages.

Here are some examples of how to use it:

  • To update the repository sudo apt update
  • Upgrade- sudo apt upgrade
  • Install the software from the repository– Syntax: [sudo] apt-get [option] Order [packg1] [packg2]
    sudo apt package-name, Example sudo apt install vlc
  • We can too install local Debian packages By using it. One of the advantages of using apt instead dpkg that is, it automatically downloads the dependencies required by that particular Deb program that we install. So the syntax will be – sudo apt ./filename, for example, to install Google Chrome using its deb package file sudo apt ./google-chrome-stable_current_amd64.deb
  • apt-get dist-upgrade – updates all packages and removes these conflicts, so that the operating system can be prepared for the version upgrade.

apt-cache – Show information about packages and sources

Running apt-cache will not affect or change anything in the system. Its only purpose is to display the data in the package cache or the package metadata. The package cache is the internal database that stores information about all available packages.

apt-cache [Option] commando [Packg-name]

Exampleapt-cache showpkg vlc

To note– Some orders may require sudo

Commands for apt-cache
add Adds a file with package indexes to the package cache.
gencaches Builds the package cache.
exhibition package Displays meta information.
Statistics Displays statistics on the package cache.
showsrc Displays information about the source code of a package.
unload Displays a list of all available packages based on the package cache.
dumpwork Displays a detailed list of all available packages based on the package cache.
not satisfied Displays a list of all unfulfilled dependencies.
spectacle Displays package information for one or more packages.
to look for Searches the package information for one or more search terms.
depends Displays a list of package dependencies.
depends Displays a list of packages based on the package entered.
package names Displays a list of wrap names starting with the search term.
cracked Creates a list of package dependencies that dottycan be treated with.
xvcg Creates a list of package dependencies that xvcgcan be treated with.
Politics Displays the priorities of the sources or of a package.
madison Displays the available versions of a package in the different sources.

apt-search – Find packages in repositories

Many times we want to install a package but we don’t know if it’s available in the official repository or exactly under what filename.

For example, we want to install the KDE login app available in the official Ubuntu repository, but how do we know the exact name of the package to use with the apt command. So, we are going to search for it:

apt search "Kdeconnect"

Likewise, we can use the search command to find other programs or packages available in the added repositories on Ubuntu.

apt-mark – keep current version

When we run the update command, the process updates all installed packages, however, in case we don’t want to update a particular program, there is an apt-mark command that helps us do that. For example, we want to keep the updates for the installed Firefox version, so the syntax will be:

sudo apt-mark hold firefox

And to unlock it, use:

sudo apt-mark unhold firefox

2. Snap- Universal Package Manager

Snap or Snappy is another Ubuntu package manager, also now available by default on all the latest versions of Ubuntu. It is a software deployment and package management system developed by Canonical to provide a universal package management platform for all major Linux distributions. This meant primarily for a server or cloud environment and also for the Internet of Things. However, it can now be found in desktop versions and even integrated into Ubuntu’s Software Manager GUI.

The Snap repository contains hundreds of software packages or open source applications that are very easy to install. The best thing is that the same package available in Snap can be installed on Ubuntu, RHEL, OpenSUSE, etc. whatever their base or code. This is because the snapshot packages are an image based on the SquashFS filesystem. All pictures are saved under /var/lib/snapd/snaps/Nameofpackage.snap . When the system is booted, the current version of the snaps is mounted, the mount point is the snap directory. If the program contained in the snap package is called, the data is transparently pulled from the snap and executed at runtime. As a result, some snaps may start up slower than programs installed through the Package Manager, which are stored uncompressed.

Therefore, it is possible to install the same program from the SNAP and DEB packages using normal package management without creating a conflict. To learn – Snap on Linux – Install, update and remove commands

sudo snap install package-name– To install packages from Snap

sudo snap remove package-name– To remove the installed package

snap list --all – Will display any installed SNAP programs or packages

snap changes – Displays the progress of installations, reinstallations, etc. of snaps.

sudo snap refresh– the refresh command updates all the snaps:

sudo snap refresh package-name – You can also specifically update individual snapshots.

snap list – lists the installed snaps. The snap’s name, version, revision, track / channel, developer, and ratings are displayed by default.

snap --help – List of commands related to SNAP

3. Flatpak – Package manager

Flatpak as Ubuntu Package Manager is an alternate option for capturing apps. If you don’t want to use SNAP, this package manager is a good option. Just like SNAP, we can also install various software from its library without creating any conflict, even if the same software was installed on the system using the default APT manager. Flatpak places all of its binaries, libraries, configuration files, and other required files in a / var / lib / flatpak / app directory.

So, it can be installed and used on different types of popular Linux distributions without any further adjustment. All the major open source applications are available in its repository called FlatHub.

Key commands

sudo flatpak update – Update installed programs

sudo flatpak install pacakge-name – To install the packages available in FlaHub.

sudo flatpak uninstall pacakge-name- Uninstall apps

flatpak list– List of installed programs

Here is the official documentation for more – Flatpak.

Endnotes – Ubuntu Package Manager

Although Snap and Flatpak are universal package managers, APT is a major package management system for all Debian-based Linux distributions due to its stability and easy-to-use command syntax; moreover, besides package management, it can also do a lot of things such as adding repositories, updating and upgrading the system … While Flatpak and Snapp can only handle managing packages. applications. However, in the future, Ubuntu may give SNAP weight over APT due to its growing library and Canonical’s ability to control it.


Comments are closed.