Ubuntu package management makes it really easy to download and install the packages you want. These packages contain binaries, libraries, headers and other files needed to execute an application. Sometimes you may wish to have a look at the source code used to create an application or library. If you are lucky, the source code might be available on GitHub or BitBucket for easy browsing and cloning. If not, you can always get the source package. A source package contains the source code that was used to create one or more binary packages that you typically install to get binaries or libraries.
First, find out the name of the source package you will need. Go to Ubuntu Packages Search, in the search section choose the Source package names and search. You should be able to find the name of the source package that you want.
Next, use the name of the source package with apt-get:
$ apt-get source vim
This downloads the source package to your current directory and unzips it. So, you do not need sudo permission for this.
Browse the source code of your favorite packages and learn 😊
Tried with: apt 0.8.16 and Ubuntu 12.04 LTS