Where does /usr/bin/grep come from in Ubuntu Focal [duplicate]

When I run which grep on Ubuntu Focal, I get /usr/bin/grep. However, apt-file search /usr/bin/grep does not show a package which delivers it. Moreover, dpkg-query -L grep only shows /bin/grep (among other related executables). So, what package delivers /usr/bin/grep?


Solution 1:

The package grep.deb installs the grep binary in /bin. In recent times, the /bin and /usr/bin have been unified in Ubuntu and many other linux distributions by symlinking /bin to /usr/bin. Thus, any binaries installed in either directories end up in /usr/bin.

/usr/bin is the directory that is included in the search PATH. Therefore, which grep identifies the file as /usr/bin/grep.