How to get information of all installed packages

Asked by dotslash on 2011-06-12

I'm writing a small application(for educational purpose) which displays a list of applications which match with a query .
And If the user selects a particular result(which is an application) ,I need to run that application.
(some thing similar to gnome-do)
For this I need information about where the main executables and icons of the applications are located.Where can I get this information from.
I know that all the important installed packages have their main executables stored in $PATH But I felt that that might not be of great help

Question information

English Edit question
Ubuntu dpkg Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :

if you run:

which firefox

(I assume you have it installed). It will show you the location of the binary executed. The icons are stored in /usr/share/icons

Revision history for this message
mycae (mycae) said :

Hi Sai,

You may wish to read up about the Filesystem Hierarchy Standard, which specifies the location of specific categories of files, such as program executables (aka binaries), icons, application data, etc. etc.

In theory, and to a reasonable extent, practice, this is how linux systems are laid out.

Revision history for this message
dotslash (dotslash) said :

@mycae, actionparnship : Thanks for the help, I guess my problem is almost solved.
So I plan to do it like this.First of all I'll get the list of all installed applications using 'dpkg --get-selections' and check if there exists a binary corresponding to that package using 'which'.
I'm not sure if it works. But I have to give a try.

Revision history for this message
mycae (mycae) said :

That strategy is not portable to non-debian unix systems, if that matters to you.

dpkg is the debian package tool, so you won't be able to find that (for example) on a redhat, or apple system.

simply "ls" in /usr/bin /usr/sbin and /usr /bin might work, depending upon your problem.

Can you help with this problem?

Provide an answer of your own, or ask dotslash for more information if necessary.

To post a message you must log in.