Skip to main content

Debian-ubuntu vs Redhat-CentOS commands

If you are used to work with Debian based distributions as well as RedHat based distributions this post is useful to see what is the counterpart command in both systems:

[table width=”600″ border=1 colwidth=”200|200|200″ colalign=”left|center|center”] Command Description,Debian,RedHat
Search package,apt-cache search package,yum search package
Look available packages in the repository,apt-cache show package,yum –showduplicates list package | expand
Install specific package version,apt-get install package=x.y.z,yum install package-x.y.z
List files installed by a package, dpkg -L package, rpm -ql package
Which package has installed the file, dpkg -S /path/to/file, rpm -qf /path/to/file or yum provides /path/to/file
Look if the package is installed, dpkg -l | grep package, rpm -qa | grep package
[/table]

dpkg: warning: files list file for package ‘lsof’ missing; assuming package has no files currently installed

Some errors got installing/removing packages after repairing a broken root file system:

dpkg: warning: files list file for package 'lsof' missing; assuming package has no files currently installed

I fixed these messages creating the package file list again:

dpkg-deb -c /var/cache/apt/archives/lsof_4.86+dfsg-1_amd64.deb | awk {'print $6'} | cut -f2- -d. | sed 's|^/$|/.|' | sed 's|/$||' > /var/lib/dpkg/info/lsof.list

And then:

# apt-get -d install lsof --reinstall