Countless times it happens that, we need to know the path of a certain application either for reasons of fault diagnosis or just trying to find solutions to unexpected problems.
It is not always easy to find out the exact path in which one of our applications was installed. It is even more difficult to figure out all possible files related to that app, which in many cases may be scattered throughout different folders on the system.
I want to show you how to solve this situation easily using the shell and the useful commands that Linux always has up its sleeve to help us without using external applications.
I will use Firefox as an example in this article, so let’s start: let’s say you want to know where exactly Firefox was installed, for this, we use the “which” command as follows:
This will return the following output:
That’s how easy it is to find out the path of an application in Linux, this is the case with any distro which is a Debian-based Linux system.
But let’s go further, let’s say you also need to know which files are related to that application. For that too there is an easy way out and the terminal comes to the rescue.
For that case we would use the command:
dpkg --listfiles package_name
For example to find all the files related to Firefox regardless of where the main directory of the application is installed we would use:
dpkg --listfiles firefox
This command would return the following useful information:
/. /etc /etc/apparmor.d /etc/apparmor.d/disable /etc/apparmor.d/usr.bin.firefox /etc/apport /etc/apport/blacklist.d /etc/apport/blacklist.d/firefox /etc/apport/native-origins.d /etc/apport/native-origins.d/firefox /etc/firefox /etc/firefox/syspref.js /usr /usr/bin /usr/lib /usr/lib/firefox
For the purposes of this tutorial, I have reduced the list of files shown above, but normally the list will be much larger.
Please note that the list of related files is not exclusive to that application, some of them can, and will be shared with other applications. So in the event of uninstalling a certain program which gave you trouble, for example, one that was not removed correctly, don’t base your decision on which files to delete solely on this list, you should exercise common sense and only delete those files which are 100% sure they belong to the application in question.
So it should no longer be a source of stress for you figuring out the paths to your apps in the system from now on. We hope you find it useful, and if you know of another method, do use the comment system and let me know.