Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm used to RPM based systems, and there's many commands I'm not yet sure how to do with .deb packages. This is mostly for use with custom packages, i.e. not stuff apt-get installed.

It'd be great if someone could provide a translation of the commands here: (by "package file" it's meant to operate on a physical .rpm/.deb file)


Feature                              rpm                                deb
----------------------------------------------------------------------------------
View all installed packages          rpm -qa
View files in an installed package   rpm -ql packagename
View files in an package file        rpm -qlp ./packagename.rpm
View package info, installed package rpm -qi packagename (1)
View package info, package file      rpm -qip ./packagename.rpm (1)
View pre/post install shell scripts  rpm -q --scripts packagename
View changelog for a package file    rpm -qp --changelog ./packagename.rpm
Uninstall a package                  rpm -e packagename                    dpkg -r/dpkg -P
Install a package file               rpm -ivh ./packagename.rpm            dpkg -i
Upgrade a package from a file        rpm -Uvh ./packagename.rpm
Find which package owns a file       rpm -qif /some/file.foo
List dependencies of a package       rpm -q --requires packagename
List dependencies of a package file  rpm -qp --requires ./packagename.rpm

(1) see e.g. info output example here

share|improve this question

2 Answers 2

up vote 7 down vote accepted

I try to fill or complement what @SeanBright leaved out:

Feature                              rpm                                   deb
----------------------------------------------------------------------------------
View all installed packages          rpm -qa                               dpkg -l, dpkg-query -Wf '${Package}\n'
View package info, installed package rpm -qi packagename (1)               apt-cache show packagename
View pre/post install shell scripts  rpm -q --scripts packagename          cat /var/lib/dpkg/info/packagename.{pre,post}{inst,rm}
View changelog for a package file    rpm -qp --changelog ./packagename.rpm dpkg-deb --fsys-tarfile packagename.deb | tar -O -xvf - ./usr/share/doc/packagename/changelog.gz | gunzip
Uninstall a package                  rpm -e packagename                    apt-get remove/purge packagename
Upgrade a package from a file        rpm -Uvh ./packagename.rpm            dpkg -i packagename.deb
Find which package owns a file       rpm -qif /some/file.foo               dpkg -S /dome/file.foo
List dependencies of a package       rpm -q --requires packagename         apt-cache depends package
List dependencies of a package file  rpm -qp --requires ./packagename.rpm  (shown in package's info)
share|improve this answer

I added the ones that I knew off-hand:

Feature                              rpm                                   deb
----------------------------------------------------------------------------------
View all installed packages          rpm -qa                               dpkg --get-selections
View files in an installed package   rpm -ql packagename                   dpkg -L packagename
View files in an package file        rpm -qlp ./packagename.rpm            dpkg -c ./packagename.deb
View package info, installed package rpm -qi packagename (1)               dpkg -s packagename
View package info, package file      rpm -qip ./packagename.rpm (1)        dpkg -I ./packagename.deb
View pre/post install shell scripts  rpm -q --scripts packagename
View changelog for a package file    rpm -qp --changelog ./packagename.rpm
Uninstall a package                  rpm -e packagename                    dpkg -r/dpkg -P
Install a package file               rpm -ivh ./packagename.rpm            dpkg -i
Upgrade a package from a file        rpm -Uvh ./packagename.rpm
Find which package owns a file       rpm -qif /some/file.foo
List dependencies of a package       rpm -q --requires packagename
List dependencies of a package file  rpm -qp --requires ./packagename.rpm

Also, this page has most (all?) of the information you are looking for.

share|improve this answer

Your Answer

 
discard

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.