3

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?

1
  • On my Ubuntu system, /usr/bin/grep and /bin/grep are the exact same file. Probably it gets copied over during the installation process?
    – Ray
    Aug 18, 2021 at 3:25

1 Answer 1

5

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.

Not the answer you're looking for? Browse other questions tagged .