Ubuntu – How to fetch the code of the binary installed on a machine

source code

I am a newbie in linux and using ubuntu as my desktop os. Most of the time I feel the need to look at the code of the utility like ls, rm etc. Can anyone tell me how to get the code for these utilities.

Currently I am looking for the implementation of ssh-copy-id utility.

Best Answer

  • You can fetch the source of a package with:

    apt-get source [package]
    

    Make sure you have the deb-src lines in /etc/apt/sources.list generally, copying the deb lines and changing deb to deb-src is enough.

    If you don't know the name of the package with the file in question, you can get that info with apt-file. However, I can't remember how off the top of my head. I recommend reading the docs. :)

  • Related Question