sometimes, if I want to install a program from the terminal, I get 2 options: apt and snap.
It can happen that the displayed versions are not the same, one candidate shows a higher version number than the other.
Do both libraries use the same numbering system and is it safe to assume that the higher the version number is, the newer the program is and one should only consider this variable to install new stuff?
Snaps (and flatpaks) have a much better way of handling DLL hell than good ol deb/rpm/pacman. As such, each app is better able to chase the latest version of all of its dependencies, without worrying about messing up the libraries for anyone else.
Snap/flatpak also sandbox their apps, reducing the blast radius of exploited or bad apps.
My personal preference is to use flatpak, and set it up so that it is all --user. With a --user install, you don’t need sudo to update anything. Use Flatseal to tighten up or loosen the sandbox, use Warehouse to roll back any broken updates. I don’t think snap has any tools like Flatseal or Warehouse, which makes it the weaker packager.
Anything that can be installed as a flatpak, I do it there first. Then I can just pick up my home directory, drop it in a different distro, and almost all of my stuff follows. A distro becomes little more than “a kernel, a compositor, a baseline desktop environment, and some background daemons”.
They both use upstream version number (as in the number software developer gave to the release). They might additionally have some kind of revision number related to packaging or some patch number, but as a rule of thumb, yes, the bigger number is the most recent. If you should use that as a only variable on deciding which to install is however another discussion. Sometimes dpkg/apt version is preferred over snap regardless of version differences, for example to save a bit of disk space, but that depends on a ton of different things.
TL;DR: there’s no inherent difference. Snaps are newer the more time has passed since you installed a major operating system update. Newer is often better, but not always. Pick whatever you prefer.
The version numbers themselves generally follow the same format. Snaps don’t technically need to follow the apt version patterns, but often do for convenience. They usually use semantic versioning, so 2.0 is newer than 2.1, but 2.10.1 is newer than 2.2.99 (you need to read them as separate numbers, from left to right, not as decimal numbers!).
apt packages are generally stable versions. They get a major version bump every time your OS gets a major update, but generally stay on the same major version until the next major update. This way, no updates will suddenly leave you with a broken configuration.
Ubuntu released a major update last month, so if you have that version, most packages are relatively new. However, all the apt packages that this release came with will stay on the same major version for the next ten years. For things like browsers, this is a problem. For professional workstations, this may be exactly what you want.
Snap packages are maintained separately. They can be newer, older, or the same version. Snap is an alternative method of distributing applications that Canonical, the company behind Ubuntu, really wants people to use. Most likely because they own the Snap Store and use it to sell services to businesses, so the more people using that, the larger their potential customer base.
There are apt packages not maintained by distributions that do regular major updates. Mozilla, for instance, has a repository of packages for Firefox that receive regular updates, as Ubuntu has removed the Firefox apt packages and redirected them to Snap packages instead (which sparked some wold controversy in Linux communities online).
In my personal experiences, snaps still cause slowdowns on boot/first load if you install too many of them. They’re also limited in other ways (i.e. restricting where applications can save files).
Lastly, there’s a third common method for distributing applications: Flatpak. Flatpaks are a bit like Snaps, but built differently, in a less centralised way. I prefer them over Snaps, but Ubuntu removed the ability to use them in their default software browser (again sparking controversy) so they may not be for you.
You can use all three. You can even use them to install multiple versions of the same application!
Fuck canonical, me and my homies use pop os and flatpaks
Generally yes, but keep in mind that apt packages are maintained by canonical, while snap packages could be maintained by canonical, the apps’ original developers themselves (e.g. Firefox snap is maintained by Mozilla), or a 3rd party unrelated to canonical or the app’s developer (i.e. random dudes packaging apps into snap and submit them). If the snap packages are not maintained by canonical, there is nothing stopping the snap packagers to use a different versioning scheme, though it’s unlikely. In general, it’s a good idea to check the package entry on snapcraft.io to figure out who packaged them so you can decide if it’s trustworthy or not.
wow, your profile gif is awesome :D