Source code!

I am looking for source code for anything basically. Well, what I want, I don’t know exactly what or where I need to look or what I am looking for.
As it’s said, the programs for most of the stuff installed on my system is Open Source but I don’t know anything about it.
I have Python installed and I’m assuming it is like some of the coding that I’ve seen that has the .py’ extension. I may well be wrong.
As I most likely am wrong, what do I need to edit the source code and what does it look like and where can I get some, e.g. the source code for Ubuntu 12.04.
I just want to get hold of some so that I can see exactly what it looks like.
I need help…

You do realise that Ubuntu is (the distribution) is basically made up of a loads of different packages.
I’d probably narrow down to what packages you want to look at and go from there.

First you must put some ‘source’ URIs in your sources.list

Then you can download it through apt:

apt-get source packagename

Source Code is human readable code (well some humans anyway), that can be “compiled” into machine code … it’s not always “Python”.

Try reading the code of a pre-compiled binary executable such as /bin/bash … you’ll quickly see you can’t

But if you do what SeZo says, and enable the “source” repositories … then download the source code with:

apt-get source bash

you’d find the source code (for bash) in your current directory (usually as a tar.gz) … that IS human readable, editable, and can then be compiled into a working binary executable.

Also as SeZo alludes … you can’t get the source code for “Ubuntu”, though you can get the source code for the packages that make up Ubuntu. (well most of it … there are SOME proprietary bits in Ubuntu that you cannot get the source code for).

The source code is also normally available from the software authors home website … and maybe a few other places, git, freshmeat, sourceforge, etc.

I didn’t know that about the code, it’s not really what I want then.
What I want is some python ‘.py’ to look through and try to understand how the language/commands work to help me a bit more as I would probably understand it reasonably well as I did a course in C & COBOL (yes, I know that its ancient) but it will help.

Some of the projects at Tuxradar’s “Learn Python Tutorials” … here:
contain the python code, if that’s any good to you.

or search the web for “python projects” … maybe github, or freecode, or freshmeat, or sourceforge

I tried that but don’t know where it’s put it and I think it’s took up quite a lot od space on my HD and now want to delete them.

Thanks Mark, that’s brilliant, something to get my teeth into :slight_smile:

It would have downloaded to the current directory … probably your home folder, if you’d just opened the terminal and not changed directory

If you downloaded the “bash” source code as I described … there will probably be 3 files called something like :-

bash_4.2.orig.tar.gz <— the original source code from the author
bash_4.2-2ubuntu2.diff.gz <— the difference file, containing the edits Ubuntu have made to their version
bash_4.2-2ubuntu2.dsc <— the Debian Source Control file … which contains info such as
build dependencies, package lists, checksums, etc.

There are TONS of Python tutorial websites, just search for “python tutorials” … a good starting point is always the horses mouth:

Then there’s always this: