I just managed to overwrite
and it doesn't seem like it's possible to undo.
I did this as a root user.
Am I doomed?
Not doomed at all.
Nothing critical in a Ubuntu Desktop or Ubuntu Server install uses
dpkg -S /usr/share/bin to list your installed packages that use dir. Those packages, if any, should be reinstalled.
If the reply is
no path found matching pattern, then you indeed have nothing installed that uses the dir.