Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 6291  / 3 Years ago, fri, september 3, 2021, 2:10:55

If I were to install the same application both as a snap and using APT, how would I be able to call each one separately and how would I know which one was running?


I am not yet fully convinced that snap is best for the end-user and want to compare the performance of a few packages.


More From » snap

 Answers
5

Call each one separately


You can start a specific version of an application by providing the full path name of the executable. Firefox, e.g., installed using APT will be launched by /usr/bin/firefox. The executables of snap applications are under /snap/bin/ so /snap/bin/firefox will launch the snap version.


Typing firefox will launch the APT version, because /usr/bin is listed earlier in the search path than /snap/bin in a default Ubuntu install. The default PATH is:


$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

When you simply type firefox, the system searches each of the consecutive directories (folders) until an executable with the name firefox is found. If the APT version is installed, it will find the executable in /usr/bin before searching /snap/bin, so the search will be stopped and that executable will be launched.


You can learn which executable will be launched with the command which.


$ which firefox
/usr/bin/firefox

You can learn which executables you have installed with the command whereis:


$ whereis firefox
firefox: /usr/bin/firefox /usr/lib/firefox /etc/firefox /snap/bin/firefox /usr/share/man/man1/firefox.1.gz

Here, both the APT and the snap version of firefox are installed.


Know which one is running


Running processes


The command ps ax lists all running processes. Thus:


ps ax | grep firefox

will list all processes with the name "firefox". The output includes the full pathname of the executable.


Creator of a specific window


It is also possible to identify the creator of a specific window, to learn whether the open window is from the APT or the snap version. However, this is rather complicated and not always reliable. See the Unix & Linux Stackexchange questions What process created this X11 window? and What process created this window with no PID associated?.


[#3273] Friday, September 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zombieptu

Total Points: 490
Total Questions: 121
Total Answers: 108

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
zombieptu questions
Sat, Feb 18, 23, 20:00, 1 Year ago
Sun, Feb 27, 22, 02:41, 2 Years ago
Sat, Oct 30, 21, 00:00, 3 Years ago
;