Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

How to use Snap and Apt for Package Management in Ubuntu

Published

Linux and Commands

Managing software on Ubuntu is a key part of keeping your system running smoothly. Ubuntu gives you two powerful tools for this: Apt and Snap. These tools let you install, remove, and update programs easily. While they may seem similar, they work in different ways and can be suited to different situations. Below, you’ll learn more about what makes Apt and Snap unique, when you should use each, and how to use them step-by-step with some extra helpful details.

Understanding Apt: Ubuntu’s Classic Package Manager

Apt, short for Advanced Package Tool, is the standard way to manage packages on Ubuntu and other Debian-based systems. It works with software packages stored in large online repositories controlled by Ubuntu. These packages are built just for your version of the system, which helps with reliability and stability. When you install a program using Apt, it downloads the necessary files and makes sure any other related programs, called dependencies, are installed too.

Apt uses .deb files, a format used widely on Debian and Ubuntu systems. When you install, update, or remove a package with Apt, the package manager takes care of all the hidden details to avoid problems with your system.

What is Snap and How is it Different?

Snap is a newer tool developed by Canonical, Ubuntu’s parent company. Snap packages are designed to work not only on Ubuntu but also on many other Linux systems. Snap makes it easier to get the newest versions of software, as the packages are updated directly by the developers and are self-contained. This means a Snap package has everything the software needs: libraries, dependencies, and other files, all bundled together. Because of this, Snap apps are isolated, which can improve security, but it also means they use more disk space and may start up more slowly.

Snap packages are installed, updated, and removed with a single command — and all snap apps get updated automatically in the background, so you always have the latest version.

When Should You Use Apt or Snap?

Apt is a great choice for users who want trusted, stable, and well-tested programs. The software in Apt’s repositories might not always be the latest version, but it should run smoothly on your system.

Snap is best if you need the newest version of an app, want to try out something not available in your software center, or need software that is updated more often. Some programs are offered as both apt and snap packages, so it’s up to you. Just be aware that two versions of the same program can be installed at once with both systems.

How to Use Apt: Step-by-Step

Step 1: Open the Terminal. The fastest way is by pressing Ctrl + Alt + T.

Step 2: Update the list of available software to make sure you’re installing the latest package from the repositories:

sudo apt update

Step 3: To upgrade installed software on your system to the latest versions available, run:

sudo apt upgrade

Step 4: To install a new package — for example, Firefox — use:

sudo apt install firefox

This command will also handle any extra dependencies needed by the software.

Step 5: If you want to remove a program, type:

sudo apt remove firefox

Step 6: To search for a package (if you aren’t sure of the name), use:

apt search name

This shows a list of packages matching your search, including a brief description.

Step 7: To clean up unused packages and free up space, try:

sudo apt autoremove

How to Use Snap: Step-by-Step

Step 1: To find a software package available as a Snap, search by keyword:

snap find keyword

This will return a list of available Snap apps.

Step 2: To install a Snap package, use:

sudo snap install package-name

For example, to install the Visual Studio Code as a Snap:

sudo snap install code

Step 3: To update all installed Snap packages so that they are up to date, use:

sudo snap refresh

Snap will also auto-update apps in the background, but you can use this command to force updates when you wish.

Step 4: To remove (uninstall) a Snap app, use:

sudo snap remove package-name

Step 5: To list all Snap packages currently installed on your system, type:

snap list

Pros and Cons of Both the Package Managers

Using Apt means using packages tested by Ubuntu, with efficient use of disk space, as many apps use shared files. However, new versions of software may take a while to become available. Snap gives you the latest programs and can be used the same way on many distributions, but snaps run isolated and usually need a bit more storage and memory. Some users also notice Snap apps start up a little slower because they are self-contained.

Can I Use Both on the Same System?

Yes, you can use both Apt and Snap without any trouble. Some Ubuntu versions now install certain programs, like Firefox, as snaps by default, even if you install them from the Software Center. If you need a particular version or want to avoid snaps, it’s good to check how a program is installed. If you have both versions of a program, run which program-name or snap list to check which one will be used when you type the command.

Conclusion

Apt and Snap are the main ways to manage software on Ubuntu. Both tools have their strengths, and it’s common to use them together. Use Apt for stable, tried-and-true apps, and turn to Snap for cutting-edge software or cross-platform compatibility. With just a few commands, you can easily explore, install, update, or remove almost any app you need on Ubuntu.

Related guides

Account services are unavailable until the production backend is configured.