Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 need to determine what package manager a given system uses, but am limited to checking file existence. I am looking for a file that does (to some degree) prove that the distribution at hand has an RPM database or uses apt/debs . I immediately think of /etc/apt/sources.list for example. I know I can't get %100 of all cases, but I'd like to get as close as possible for the major distros (e.g. Debian based, Red Hat based, etc..)

Thank you!

share|improve this question
For Debian systems you would probably be better off looking at /var/lib/dpkg/. Having APT configured is not an absolute requirement. – Zoredache Jan 17 '13 at 20:42
Brilliant! Thank you, that's a good start. What about for RPMs? Where are they typically kept? – chao-mu Jan 17 '13 at 20:58

For RPM, you'd have /usr/lib/rpm.

Or you could directly check for the core executable: /bin/rpm (dunno Debianites). Probably the best bet, is to look for the basic executable. Should help for other, more exotic, package management systems too.

BTW, what are you trying to do? And why the strange restriction on "only check for file existence"?

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.