I'm not sure if it is possible, but if it is, how can I find all the files related to a software? For example, is there any way to find all files that gedit needs and uses to work?
Does such command/techniques gather files like /usr/share/gtksourceview-3.0/styles/oblivion.xml which is not dedicated only to a certain software or owned by a different one?
2 Answers
To list files belonging to a package, run
$ dpkg -L packagenameNote: does not include configuration files, usually.
To find the package a file belongs to, run
$ dpkg -S /path/to/file This is a non-trivial problem, I'm afraid. Some approaches that might help you:
You can find all the files installed by a particular package by looking in
/var/lib/dpkg/info/gedit.list.You can find all of the other packages on which
geditdepends by runningapt-cache depends gedit. (Conversely, you can find all the packages which depend ongeditwithapt-cache rdepends gedit). Bear in mind that these functions aren't recursive - forgeditto successfully run requires a great deal of your system - eg, the C library, the X graphics system, the dbus system message bus...You can find out which library files an executable requires at runtime by running
ldd $(which gedit). (which geditreturns the path to the actual executable run when you rungedit, in this case/usr/bin/gedit).You can find out which files a given process has (currently) open by running
lsof -c gedit. (The program may load files, eg icons into memory at startup and close their file descriptors, which won't show up in such a list).