Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 anyway 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?

share|improve this question

To list files belonging to a package, run

$ dpkg -L packagename

Note: does not include configuration files, usually.

To find the package a file belongs to, run

$ dpkg -S /path/to/file
share|improve this answer

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 gedit depends by running apt-cache depends gedit. (Conversely, you can find all the packages which depend on gedit with apt-cache rdepends gedit). Bear in mind that these functions aren't recursive - for gedit to 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 gedit returns the path to the actual executable run when you run gedit, 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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.