Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently just wanted to look at the source code for sha1sum.

alec@ROOROO:~/tmp-source-study$ apt-get source sha1sum
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to find a source package for sha1sum

The next thing I did was to read the manual. The manual mentioned coreutils. But I don't see anything like sha1sum.c, and there's no associated Debian package for sha1sum, as far as I can tell.

What should I be doing to get the source code for this small, basic program without having to use a search engine, from the convenience of my shell?

share|improve this question
    
There is not necessarily a file named sha1sum.c. It can be basically any file or multiple files providing the functionality. If you grep for sha1 in the src folder you will notice that src/md5sum.c is the file used to compile sha1sum. Oh and jftr coretuils is the right package. –  Ulrich Dangel Jun 12 '12 at 2:40
add comment

1 Answer 1

up vote 3 down vote accepted

First, find which package the file is from:

% dpkg -S /usr/bin/sha1sum
coreutils: /usr/bin/sha1sum

And then install the source:

% apt-get source coreutils
share|improve this answer
    
ok. i did do that originally, (except i didn't know dpkg -S: that's handy) but i guess i have to look harder for the source next time. –  ixtmixilix Jun 12 '12 at 13:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.