18

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

1 Answer 1

13

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)
2
  • so to be clear, for rpm -ivh or rpm -Uvh, the equivalent for deb is dpkg -i? dpkg makes no differentiation between install and upgrade? Or it handles this automatically?
    – Daniel
    Sep 4, 2017 at 4:46
  • @Daniel if you directly use dpkg to install a deb file, it will install or upgrade or downgrade as necessary (unless doing any of those massively breaks something else, in which case you can still force the action with appropriate flags).
    – muru
    Jul 11, 2018 at 5:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .