apt & snap
Package Management
- APT
- Snap
APT
- apt is a tool that allows you to download new packages via
apt install
. Run
sudo apt install lolcat
- This will go out and fetch the package lolcat from the apt registry and install.
- After a second it should download and be immediately be available for use
This is a fun example of using the extended Debian / Ubuntu ecosystem but there are literally thousands of packages available for you to use through apt. Let's try another one.
node -e "console.log('hi')" # this will fail, Node.js is not installed
apt search nodejs
apt show nodejs
sudo apt install nodejs
node -e "console.log('hi')"
Here's a few more commands for you to know
sudo apt autoremove # will remove unused dependencies
sudo apt update # updates the list of available packages apt uses
apt list # everything installed
apt list --upgradable # everything with an update available
sudo apt upgrade # updates all your packages to their latest available versions
sudo apt full-upgrade # basically autoremove and upgrade together
That's pretty much it! While there's no official web browser experience for apt, check out this open source once.
Snap
Canonical a few years announced a new way of packaging app called snaps. Snaps are advantageous over what was there before (apt typically deals with debs) for a few reasons:
- They're totally self contained. They package all their dependencies with them
- They're sandboxed. They can't mess with your system
- They can update by just downloading the difference between ther versions
Snaps can also run on other Linux distros like Fedora, Gentoo, and CentOS as long as you download the program that runs them (snapd.)
There are two other chief competitors in this improved portable packaging format:
- AppImage
- flatpak
I just use Snap because it's made by Canonical, the same people who make Ubuntu.
- If you want more depth, click here.
What is Snap?
- Snaps update automatically and you actually can't stop that from happening really. Debs update whenever you choose to do so
- Snaps are safer. They're sandboxed and cannot break out of their home folders. Debs really can do whatever they want
- Snaps are also how Ubuntu lets publish GUI apps like Visual Studio Code, Spotify, Firefox, etc. There's more than just command line tools. [See here for the store][store].
- Debs are reviewed before they're allowed onto the registry. They have to be or else renegade devs could publish anything they want. Snaps, due to their sandboxing, don't have to be.