How to tell which version of a application is running

Karl Auer kauer at biplane.com.au
Sun Apr 16 13:24:49 UTC 2017


On Sun, 2017-04-16 at 07:23 -0500, Chris wrote:
> Question is, which version of tracker is running?

Rename the Ubuntu version to tracker.org and reboot (or restart tracker
if it's a systemd-type thing). That way it has to be your version or
none. But read the rest of this message first.

You could uninstall tracker using apt-get; it will uninstall the Ubuntu
one, leaving only yours. However, I suspect that yours will not be run
automatically without further work.

> Does the version located in /usr/local/bin take precedence over the
> version located in /usr/bin?

It depends :-)

If the program is being launched with an explicit path, then that
particular path will always be used. Some programs override it, but you
can probably see the full path in a process list.

For example, this is what I see if I grep a process list for "cups":

7270 ?        Ssl    0:00 /usr/sbin/cups-browsed

cups-browsed is started by systemd, using this service file:
 
/lib/systemd/system/cups-browsed.service

And we look inside the service file we find:

ExecStart=/usr/sbin/cups-browsed

This is typical: systemd and similar system startup methods will
generally use an explicit path, so if tracker is started automatically
by systemd (or any other automatic startup method) you will need to
adjust it to run your version. That is, you will need to edit the
relevant files to use the correct paths. Using symbolic links might
work, but can lead to extreme confusion, so I really don't recommend
it.

I suggest you run "ps ax | grep tracker" and see if the process list
tells you which executable is running. It's faster than a reboot.

If a program is run without an explicit path (which is usually the case
for things started from the command line in a terminal, for example)
then which program runs will depend on what directories they are in and
the order of those directories in the PATH variable that applies in the
environment launching the program. If you are starting it yourself, run
"echo $PATH" in a terminal to see what order they are in.

Usually, /usr/local/bin appears before /usr/bin (and /usr/local/sbin
before /usr/sbin) so that local versions of things override the
standard installs. That is usually what is required. But you should
check.

Just to make things interesting, some programs are started from
"wrappers". Firefox is a good example of this. When you run firefox,
you are actually running a script which does a bunch of stuff before
finally running an actual binary executable. The *script* is run from
your path, but it runs the "real" executable with an explicit path.

On my system, "which firefox" returns "/usr/bin/firefox", but when I
grep for firefox in a process list, I find "/usr/lib/firefox/firefox".

> Please, only helpful replies.

While it is true that people do sometimes offer unhelpful replies, very
few people provide replies that they do not themselves consider to be
helpful.

They may be wrong, but in the vast majority of cases, the attempt is
made in good faith. It is up you you to judge usefulness. If people are
willing to give of their time to try to help you, you should respect
their attempt.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: A52E F6B9 708B 51C4 85E6 1634 0571 ADF9 3C1C 6A3A
Old fingerprint: E00D 64ED 9C6A 8605 21E0 0ED0 EE64 2BEE CBCB C38B






More information about the ubuntu-users mailing list