I am familiar with the rpm package management system, because the products in our company are running in the RHEL Linux OS and the development in my daily work sometimes involves manipulating rpm packages, for example, installing, uninstall, searching rpm packages, and finding which rpm packages owns a specific file, etc. These tasks can be achieved by running ‘rpm -ivh foo.rpm’, ‘rpm -e foo’, ‘rpm -qa | grep foo’ and ‘rpm -qf /usr/bin/foo’. In fact, some of these tasks can be achieved by another advanced utility call ‘yum’. But I will not mention it here.
After using Linux as the development environment for years, I find it is really an awesome OS. So I installed Ubuntu in my personal xiaomi laptop and started using Ubuntu in my daily life. It turns out that Ubuntu can meet most of my personal needs and I can use it fluently most of the time with the experience in RHEL. In fact, I tried to install CentOS, another Linux redistribution based on RHEL, before installing Ubuntu. However, my laptop didn’t work well under CentOS. There are issues for touch panel, functional keys in the keyboard, display resolution and so on. At last, I chose Ubuntu after a few investigation.
After saying so much about the background, I just want to show my intent that I will write posts about the skills in using Ubutu/RHEL Linux now and then, so that I can look back at these skills when they are needed.
The below command can be run in order to find which package owns the particular file in Ubuntu
dpkg -S /usr/bin/foo
for example,
$ dpkg -S /usr/bin/xhost
x11-xserver-utils: /usr/bin/xhost
Another command that is used to achieve the same purpose in Ubuntu is as below:
$ apt-file search /usr/bin/xhost
x11-xserver-utils: /usr/bin/xhost
The corresponding command in RHEL Linux is as below:
rpm -qf /usr/bin/foo