Ubuntu Package Managers on the command line help us to install & delete packages, add or remove repositories, update installed applications, search packages, and more…
What is a Package manager?
A Package manager is a tool that automates the management process ( installing, updating, configuring, and removing) of computer programs on operating systems.
Although we can use Ubuntu’s GUI package manager that is its Software manager app, many programs are only available through the command line or in the third-party repository. Apart from using Ubuntu’s default package manager such as APT in GUI, many powerful features that are easy to use in Terminal.
Ubuntu consistently uses APT ( Advanced Packaging Tool ) or dpkg for package management. This means that software can be reliably installed and uninstalled in packages. Event the GUI software manager on Ubuntu uses APT. And because of its popularity among desktops and servers than other Linux distros, a huge collection of programs are available such as additional software, applications, and drivers that can be installed with the help of just a few commands.
However, here we will not only discuss APT but also other package managers, for example, SNAP that has been another option in Ubuntu since 2014 to install the software in parallel to normal package management without conflicts. All packages that belong to the system and the desktop are still installed (exclusively) via apt.
APT is the default management system that was developed for Debian, since Ubuntu and other similar operating systems based on it, thus all use the APT.
We can use APT to search for program packages to install them or bring the whole system up to date. It is not just limited to this, a variety of tasks can be done using it, and here some common examples of how to use the APT Ubuntu package manager on the command line.
In the old systems such as Ubuntu 20.04, the apt was used along with get, however, in the latest version, we don’t need to use it for downloading and installing various packages.
Here are examples to use it:
Running apt-cache will not affect or change anything in the system. Its only purpose is to show the data in the package cache or package metadata. The package cache is the internal database that stores information about all available packages.
apt-cache showpkg vlc
Note– Some commands may need sudo
Many times we want to install some package but we don’t know whether that is available in the official repo or under exactly what file-name of it.
For example, we want to install the KDE connection app that is available in the official Ubuntu repo but how do we know the exact package name to use with the apt command. Thus, we will search it:
apt search "Kdeconnect"
In the same way, we can use the search command to find out other available programs or packages in the added repos on Ubuntu.
When we run the update command, the process updates all the installed packages, however, in case we don’t want to do update some particular program then there is an apt-mark command that helps us to do that. For example- we want to hold the updates for the installed Firefox version, so the syntax will be:
sudo apt-mark hold firefox
And to unhold it use:
sudo apt-mark unhold firefox
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 distros. Primarily it meant for a server or cloud environment and also for the Internet of Things. However, now it can be found in the desktop versions and even integrated into the GUI Software Manager of Ubuntu.
Snap repository has hundreds of software packages or open-source applications that are way easy to install. The best thing is the same package available in Snap can be installed on Ubuntu, RHEL, OpenSUSE, etc. regardless of their base or code. It is because snaps packages are an image based on the SquashFS file system. All snaps are saved under /var/lib/snapd/snaps/Nameofpackage.snap . When the system is started, 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 extracted from the snap and executed at runtime. As a result, it can happen that some snaps start more slowly than programs installed via the package manager, which are stored uncompressed.
Therefore, it is possible to install the same program from the SNAP and DEB package using normal Package management without creating any conflict. Learn – Snap on Linux- Installation, update and delete 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 show all installed SNAP programs or packages
snap changes – Shows the progress of the installations, reinstallations, etc. of snaps.
sudo snap refresh– command refresh updates all snaps:
sudo snap refresh package-name – You can also specifically update individual snaps.
snap list – lists the installed snaps. The name, version, revision, track/channel, developer, and notes of the snap are displayed by default.
snap --help – List commands related to SNAP
Flatpak as Ubuntu Package Manager is an alternative option to snap apps, if you don’t want to use SNAP then this package manager is a good option. Just like SNAP, we can also install various software from its library without making any conflict, even if that same software has been installed on the system using the default APT manager. Flatpak places all its required binaries, libraries, configuration files, and other files in a directory /var/lib/flatpak/app.
Thus, it can be install and use on various kinds of popular Linux distributions without any further adjustments. All the major open-source applications are available in its repository called FlatHub.
sudo flatpak update – Update installed programs
sudo flatpak install pacakge-name – To install packages available in FlaHub.
sudo flatpak uninstall pacakge-name- Uninstall apps
flatpak list– List installed programs
Here is the official documentation to know more about – Flatpak.
Although Snap and Flatpak are universal package manager, yet APT is a major package management system for all Debian based Linux distros because of its stability and easy to use command syntax; moreover, apart from package management, it can also do lots of things such as adding repositories, system update & upgrade… Whereas Flatpak and Snapp can only handle managing of applications. However, in the future, Ubuntu may give weightage to SNAP over APT because of its growing library and the ability of Canonical to control it.
document.getElementById( “ak_js_1” ).setAttribute( “value”, ( new Date() ).getTime() );
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Linux Shout crafted as a part of our main portal H2S Media to publish Linux related tutorials and open source Software.