How can I know if the version of a program which is currently running is the one residing on disk, or if it is an older version (that may have been replaced, e.g., by an upgrade?)
1 Answer
Use lsof -p PID
and check for the "txt" field (4th column) if there is a (deleted)
next to the file name in the last field.
On Debian, you can also use the checkrestart
utility (but it may not catch all cases).
-
1Note that lsof just does the equivalent of
readlink /proc/PID/exe
, it's a bit of a heavyweight tool for reading that information. Commented Apr 15, 2021 at 12:58 -
So is it just "an exexutable with the same name/path still exists"?– Tom YanCommented Apr 15, 2021 at 13:23
-
No, the important case is to distinguish the case where there is an executable with the same name/path but it is not the version of the program which is currently running.– a3nmCommented Apr 15, 2021 at 14:15