On distributions supporting PackageKit, you can use that:
$ pkcon search file envsubst
Searching by file [=========================]
Starting [=========================]
Loading cache [=========================]
Querying [=========================]
Finished [=========================]
Installed gettext-base-0.21-4.amd64 (installed:debian-stable-main) GNU Internationalization utilities for the base system
Installed git-1:2.30.2-1+deb11u2.amd64 (installed:debian-stable-security-main) fast, scalable, distributed revision control system
Unfortunately for more reliable results across distributions you need to specify the full path, which means in your case you’d have to try various possible installation locations. Thus on Debian:
$ pkcon search file /usr/bin/envsubst
Searching by file [=========================]
Loading cache [=========================]
Querying [=========================]
Finished [=========================]
Installed gettext-base-0.21-4.amd64 (installed:debian-stable-main) GNU Internationalization utilities for the base system
and on RHEL 8:
$ pkcon search file /usr/bin/envsubst
Searching by file [=========================]
Finished [=========================]
Installed gettext-0.19.8.1-17.el8.x86_64 (installed:anaconda) GNU libraries and utilities for producing multi-lingual messages
Available gettext-0.19.8.1-14.el8.x86_64 (rhel-8-for-x86_64-baseos-rpms) GNU libraries and utilities for producing multi-lingual messages
Many distributions also install command-not-found which will tell you how to make a given command available, if possible, or suggest typo candidates.
cnfaka.command-not-found$PATH, anyway)?