Newbie Question ... getting sources.

Andrew Farris flyindragon1 at
Sun Oct 31 09:27:44 UTC 2010

On Sun, 2010-10-31 at 00:43 -0700, Ronald F. Guilmette wrote: 
> My apologies if this is an FAQ... which it almost certainly is...
> but would someone (anyone?) be kind enough to take me by the hand
> and show me how to obtain sources for, e.g. a few of the "standard"
> utilities programs that live in, like, /usr/bin ?  You know, like
> "cat" and "man" and so forth.  (No, those actually _aren't_ the specific
> sources that I want to look at, but close enough.)

Easiest way to get the source code for any program on Ubuntu (including
those that are in /usr/bin, /bin, etc...) is to first determine the
package the program belongs to, then use 'apt' to download them. 

For example... using your example above, say we want the source for
'cat'. I happen to know that 'cat' is part of the GNU Core Utilities. On
Ubuntu, the package containing these utilities is called 'coreutils', so
to get the source for these programs I would go to a terminal, and do:
        $ apt-get source coreutils

This will create a folder under your home directory that contains the
sources for the package in question. From there you may do with them
what you will.

If you have no idea what package the program is contained in, you could
also find it by searching for the name/description in Synaptic (System >
Administration > Synaptic Package Manager), or using 'apt-file' from a
terminal. The former is more helpful in the 'cat' situation because
apt-file yields so many results it's useless, where as typing 'GNU Core
Utilities' into Synaptic's search box yields 'coreutils' as the first

NOTE: For using apt-file, you may need to update the package lists
first. I.e.
        $ apt-file update
        $ apt-file -l search <some-key-words>

> I am completely new to Ubuntu, and still having a good deal of trouble
> figuring out the basic lay-of-the-land as it were.  I mean there's
> all these different versions (Meerkat, etc.), 

Ubuntu's standard numbering scheme is actually fairly straightforward.
The actual versions are a number consisting of the 'year.month' of the
version's release. i.e. the newest release of Ubuntu is 10.10 (Released
in October 2010). The 'code-names' can be a little confusing, but in
general they're just a 2-word nickname, each beginning with the same
letter, and that letter is the next letter in line alphabetically after
the previous edition's nickname... i.e. 9.10 = Karmic Koala, 10.04 =
Lucid Lynx, 10.10 = Maverick Meerkat, etc... The only exception to this
was the first version of Ubuntu... I have no idea why. Regardless, I
honestly have no idea how I remember this, I just do I guess.

> and then there's these
> four different flavors, Main, Restricted, Universe, Multiverse, and
> then, on top of all that, 

Main, Restricted, Universe, Multiverse are not different 'flavors' of
Ubuntu. Rather, they are different repositories of software available to
Ubuntu, mainly distinguished by different levels of project support/
licensing. Here's the main distinctions: 
      * Main - This contains software that is officially
        supported/maintained by the Ubuntu project 
      * Restricted - This contains software that is supported by the
        Ubuntu project, but isn't available under a completely free
        license... Typically this contains device drivers (such as for
        wireless or video) that would not be included (because of
        licensing) if they weren't absolutely necessary 
      * Universe - This contains community maintained free software,
        that isn't directly supported by Ubuntu. Most available software
        falls into this category. 
      * Multiverse - This contains software that is both not under a
        free license and not officially supported by Ubuntu.

See here: for more

> there's i386 and amd64 and... 

The terms 'i386' and 'amd64' are pretty much industry standard terms for
referring to 32-bit(i386) and 64-bit(amd64) processor architectures,
respectively. Also, just be cause it says 'amd64' doesn't mean it works
for AMD processors only... the 'amd64' term describing the 64-bit
architecture is simply called that because AMD came up with it first, so
it was named after them. There was actually a very lengthy discussion
about this on this list not long ago, and I don't feel like getting too
much into it, but pretty much just remember that.

> And then there's
> "server", "desktop", and "notebook".   

As for this... I would figure this is pretty straight forward. You pick
for the platform you intend to run Ubuntu on. By default, each of these
types is tailored to a different task. I.e.: 
      * Server - Generally intended for systems that will function in
        some sort of 'server' capacity. Servers install via the
        terminal-based 'alternate installer', load without a GUI, and
        are generally set up by default for server-related tasks
        (hosting websites/databases, file sharing, etc.) 
      * Desktop - Intended for general desktop usage. Graphical
        installer, GUI loaded by default, and probably the most widely
        used version. 
      * Notebook - Specially tailored for notebooks/netbooks (i.e.
        devices with small screens). Otherwise same as the desktop
        install (mostly)

> Oh yea, and then we have xUbuntu,
> yUbuintu, and zUbuntu, just to make things even MORE interesting.  Whew!
> (I seriously have no idea how you folks manage to keep this bewildering
> proliferation of flavors and versions all straight.)

Ubuntu is the main distro directly supported by Canonical. The different
'sub-versions' you're probably referring to (Kubuntu, Xubuntu, Lubuntu,
Edubuntu, etc...) are derivative projects more loosely affiliated with
Ubuntu, that are tailored to fit specific user's needs. Mostly this
means providing a different default desktop environment (Ubuntu uses
Gnome by default, Kubuntu uses KDE, Xubuntu=XFCE, Lubuntu=LXDE, etc...)
although several derivatives are tailored for niche uses ( Edubuntu=
Ubuntu tailored for use in education/schools, Lubuntu = Ubuntu tailored
for really low-end/old hardware, etc...)

All the different versions can get to be a bit of a mind-tangler, but
once you get past the overwhelming number of choices, the distinctions
become pretty clear.

> So anyway, I just want to download sources for the blue top bottom quark...
> with charm (of course).

      * blue top bottom - ??? no idea 
      * quark - music player daemon controlled from the gnome panel or
        cli ?? packagename: quark 
      * charm - LiveJournal and Atom blogging client for the terminal ??
        packagename: charm

> But seriously, any old (Linux/Ubuntu) sources for any flavor hardware will
> do just fine, I think, as long as they are reasonably recent.  And I don't
> need anything obscure... just sources for stuff that's likely to appear in
> /bin and/or /usr/bin even on/in a stripped-down distribution.

the methods I described waaaaaay up at the top should work just fine :)

> Oh, and ah, I'm still not quite down with this "apt" thing, so if anybody
> could explain that to me in, you know, like 200 words or less, I'd
> greatly appreciate it.  (Please don't throw rocks at me but, ah, actually,
> I'm pretty much a dyed-in-the-wool FreeBSD man myself.  So I was, you
> know, sorta hoping that I could just find a set of /usr/bin sources
> (for Ubuntu) all wrapped up pretty in a good old plain .tar.gz file that
> I could just FTP down to my FreeBSD machine.  But you know, I searched
> for about an hour for such a thing and finally had to just give up, cuz
> if such a thing is out there, then it is damn well hidden.

apt is a cli package manager for debian. It is typically used for
installing things on your computer, like so:
        $ sudo apt-get install <some-package-name>

or removing them:
        $ sudo apt-get remove <some-package-name>

fetching source code (should look familiar):
        $ apt-get source <some-package-name>

It is also used for updating package repositories:
        $ sudo apt-get update

and for upgrading packages that have updates available:
        $ sudo apt-get upgrade

It can do a lot more, but those are the most common usages.

> Thanks in advance for any pointers or help.

No problem :)

> Regards,
> rfg
> P.S.  I just built and installed the FreeBSD port of "apt", so guess I
> can now use that to get "apt" thingies down to my FreeBSD box.  But the
> question remains... What would I do with one, even if I got one?  I have
> no idea how to unpack one of those things to get at the goodies inside.

When you use 'apt-get source <package>' as explained earlier, you get an
unpacked folder in your home named after the package (i.e. for
'coreutils' I got a folder called 'coreutils-8.5' or something...) then
you may do with it what you will...

Sorry about the long reply... I hope it's helpful :)

Registered Linux User: 473690
Registered Ubuntu User: 22747

More information about the ubuntu-users mailing list