The wc command is often touted as the fastest way to count the number of lines in a file, https://unix.stackexchange.com/questions/504892/what-is-a-quick-way-to-count-lines-in-a-4tb-file
When I tried to look for the source code of wc.c
that let uses do something like wc -l
or wc -c
, I've found the code from https://www.gnu.org/software/cflow/manual/html_node/Source-of-wc-command.html but
wc.c
file is different for different unix versions, how do file the source of the wc.c
? When I tried which wc
, it only points me to the binary.Tracking a specific binary source for a specific distro:
find the binary:
$ which wc
/usr/bin/wc
find the package that provided the binary
$ dnf whatprovides /usr/bin/wc
<or>
$ yum whatprovides /usr/bin/wc
<or>
$ dpkg -S /usr/bin/wc
coreutils-8.30-13.el8.x86_64
Google the package with "src" to find the src package used to build specifically the package that you have.
In the above example its: http://vault.centos.org/8-stream/BaseOS/Source/SPackages/coreutils-8.30-13.el8.src.rpm
Download the src package and unpack it to reveal the actual source used to build wc in your distro
Compare it to the official wc.c in coreutil's github: https://github.com/coreutils/coreutils/tree/master/src