If this is happenning in Ubuntu, askubuntu.com is saying that bash uses /usr/lib/command-not-found
which uses Python's CommandNotFound
module.
You can see in /usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py
the exact lines that are responsible for "but there are X similar ones", they start at line 178 in the CommandNotFound.py file:
if len(mispell_packages)+len(mispell_snaps) > max_alt:
print("", file=self.output_fd)
print(_("Command '%s' not found, but there are %s similar ones.") % (word, len(mispell_packages)), file=self.output_fd)
print("", file=self.output_fd)
self.output_fd.flush()
return
Because there is no switch, flag or any option to make CommandNotFound.py return also list of those similar commands, if you really want to know what are those packages you could just edit this part of python file and add two lines that will print content of array with similar commands, instead of just number of things in this array. The lines that are added are lines 4 and 5 in this part of code:
if len(mispell_packages)+len(mispell_snaps) > max_alt:
print("", file=self.output_fd)
print(_("Command '%s' not found, but there are %s similar ones.") % (word, len(mispell_packages)), file=self.output_fd)
for x in range(len(mispell_packaged)):
print(mispell_packages[x])
print("", file=self.output_fd)
self.output_fd.flush()
return
Now when you save /usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py
(you need to edit it as a root), and type int
, then you got:
Command 'int' not found, but there are 18 similar ones.
('itd, 'ncl-ncarg', 'universe', '')
('ant, 'ant', 'universe', '')
('inl, 'ioport', 'universe', '')
('inw, 'ioport', 'universe', '')
('tint, 'tint', 'universe', '')
('inc, 'mailutils-mh', 'universe', '')
('inc, 'mmh', 'universe', '')
('inc, 'nmh', 'universe', '')
('nit, 'python-nevow', 'universe', '')
('init, 'systemd-sysv', 'main', '')
('itv, 'python-invoke', 'universe', '')
('itv, 'python3-invoke', 'universe', '')
('cnt, 'open-infrastructure-container-tools', 'universe', '')
('inb, 'ioport', 'universe', '')
('ent, 'ent', 'universe', '')
('ink, 'ink', 'universe', '')
('iyt, 'python3-yt', 'universe', '')
('iat, 'iat', 'universe', '')
The list contains similar commands names (itd, and, inl, inw, tint) and the packages that provides this commands (ncl-ncarg, ant, ioport) and the repo that it comes from (universe, main).
Hope it satisfied your curiosity :) To be honest I was curious too after reading your post.