How to identify the package that provides the file /usr/bin/chsh

Hi Everyone, i am just started linux basic test and stuck at Question 5.

Identify the package that provides the file /usr/bin/chsh and save the answer in a file called /opt/required_software .
Use sudo if you need to run any command with root level permissions.

Can you please guide what are the commands for this?

Do you have a link to the lab? Labs normally have a hint and/or a solution button that you can use to get the information you need.

It is not clear what version of Linux you are asking about.

For Ubuntu run:
dpkg -S /usr/bin/chsh

For Redhat run:
rpm -qf /usr/bin/chsh

Its Ubuntu.
After i type the command, it shows the package is not installed. Any idea?

This is what is looks like on my Ubuntu system:

$ dpkg -S /usr/bin/chsh
passwd: /usr/bin/chsh

If the file does not exist you will get this error:

$ dpkg -S /usr/bin/invalid
dpkg-query: no path found matching pattern /usr/bin/invalid

Can you copy and paste what you have done and include it in a code block </> so we can see what is happening?

uname -a suggests Ubuntu but if you cat /etc/os-release you will see that it’s actually Centos 8.
You will therefore use: yum whatprovides /usr/bin/chsh

@zin.sumyatnoez To clarify what @marko.vukovic is saying, uname -a is not the best way to identify the system you are running on.

If the system providing the command prompt is running as a container, uname will report the kernel version of the host machine.

cat /etc/os-release is the way to identify whether the commands you should be using are centos, ubuntu or any other distro.

So in this case, the lab is a centos container running on an ubuntu host.

1 Like