Experts,
How do I see the source code for the Linux shell command pidof ? Based on the answers for related questions I checked in the GNU coreutils. It isn't there..
If you are on Debian system like Ubuntu you can try something on these lines:
dpkg -S <utility>
, this will tell you which package installed this utility; then you can get the source using apt-get source <package-name>
. To get the source make sure you have deb-src
entry in /etc/apt/sources.list
For example on Ubuntu system I use:
$ dpkg -S pidof
sysvinit-utils: /bin/pidof
sysvinit-utils: /usr/share/man/man8/pidof.8.gz
So the package name is sysvinit-utils
$ apt-get source sysvinit-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'sysvinit' as source package instead of 'sysvinit-utils'
NOTICE: 'sysvinit' packaging is maintained in the 'Svn' version control system at:
svn://svn.debian.org/pkg-sysvinit/sysvinit/trunk
...
dpkg-source: info: extracting sysvinit in sysvinit-2.87dsf
dpkg-source: info: unpacking sysvinit_2.87dsf-4ubuntu17.4.tar.gz
Source package picked. It also inform about svn where the source is maintained.
$ ls sysvinit*
sysvinit_2.87dsf-4ubuntu17.4.dsc sysvinit_2.87dsf-4ubuntu17.4.tar.gz
sysvinit-2.87dsf:
contrib/ COPYRIGHT debian/ doc/ man/ obsolete/ README src/
I am sure there should be equivalent of this on non-Debian systems. Google might help you.
Hope this can help a bit!
Edit: A little info for yum
:
1. Search for package: yum whatprovides <package_name>
So for pidof
maybe:
yum whatprovides `which pidof`
2. Get the source: yumdownloader --source <source_name>
. You may need yum-utils
for this. More info at this link
Although I have not tried it, but I guess you can give a shot!
I found the pidof source code here: Source Code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With