Apt what provides command (equivalent of dnf whatprovides)

On CentOS and RHEL or Rocky Linux now I can use the dnf command to find out what package provides a file. Like I would run:

dnf whatprovides '*bin/ls'
dnf whatprovides '*bin/bash'

What is the equivalent of dnf whatprovides on Ubuntu server? I need apt whatprovides command.

Use the dpkg -S command:

dpkg -S /bin/grep
dpkg -S /bin/cp

You would see the package name:

coreutils: /bin/cp

Then you can install the package using the apt command:

sudo apt install coreutils

See the following page for more info: