LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2012, 08:10 AM   #1
dodo101
LQ Newbie
 
Registered: Dec 2012
Distribution: Mint
Posts: 14

Rep: Reputation: Disabled
Accessing Application Source Code


Hi all

Being a programmer, I would like to see the code of some of the applications installed on my system. What is the best way to access that code? I'm using Linux Mint 13 “Maya”.

Thanks
 
Old 12-26-2012, 08:53 AM   #2
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 133Reputation: 133
I think on debian based systems such as Mint, the easiest way would be:

Code:
apt-get source package_name
example:

Code:
apt-get source htop
 
1 members found this post helpful.
Old 12-26-2012, 12:56 PM   #3
dodo101
LQ Newbie
 
Registered: Dec 2012
Distribution: Mint
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you for the reply. I've tried your suggestion and getting the following:

Code:
magic@magic ~ $ apt-get source htop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to find a source package for htop
Am I missing the correct repositories?
 
Old 12-26-2012, 01:26 PM   #4
jkirchner
Member
 
Registered: Apr 2007
Location: West Virginia
Posts: 765

Rep: Reputation: 196Reputation: 196
Using Google and "htop source code" leads one here: http://htop.sourceforge.net/index.php?page=downloads

I do not use Mint but you should have a software sources option in your system settings, you may have to enable a repo for source.

Last edited by jkirchner; 12-26-2012 at 01:29 PM.
 
Old 12-26-2012, 01:29 PM   #5
dodo101
LQ Newbie
 
Registered: Dec 2012
Distribution: Mint
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jkirchner View Post
Using Google and "htop source code" leads one here: http://htop.sourceforge.net/index.php?page=downloads
Thank you, but I'm looking for a general way of getting source code for applications in Linux, not specifically for htop.

I checked my Repositories settings on Synaptic Package Manager and I have the Souce Code box ticked. So I'm confused as to why I can't seem to download the code

Last edited by dodo101; 12-26-2012 at 01:31 PM.
 
Old 12-26-2012, 01:30 PM   #6
jkirchner
Member
 
Registered: Apr 2007
Location: West Virginia
Posts: 765

Rep: Reputation: 196Reputation: 196
I think I edited as you were responding. Check your software sources, I see I have a block that can be checked for source. I am using Xubuntu though.
 
Old 12-26-2012, 01:32 PM   #7
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 133Reputation: 133
You need to enable the source repositories:

Code:
gksudo gedit /etc/apt/sources.list
find lines like this one:
Code:
deb http://packages.linuxmint.com/ maya main upstream import
copy-paste right below it, and add to the new line the 'src' part, so it looks like this:
Code:
deb http://packages.linuxmint.com/ maya main upstream import
deb-src http://packages.linuxmint.com/ maya main upstream import
This will enable the source repos for mint-only packages. For the ubuntu ones (basically most programs) do the same thing to lines containing the word ubuntu.


then:

Code:
sudo apt-get update
sudo apt-get install build-essential
apt-get source htop
 
1 members found this post helpful.
Old 12-26-2012, 01:48 PM   #8
dodo101
LQ Newbie
 
Registered: Dec 2012
Distribution: Mint
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thanks kabamaru, this was very helpfull.

I had to use pluma rather than gedit (I think pluma is the default text editor in this version of Mint), so I typed:
Code:
gksudo pluma /etc/apt/sources.list
I then changed the sources.list file as you suggested, and success followed:
Code:
magic@magic ~ $ sudo apt-get source htop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Need to get 395 kB of source archives.
Get:1 http://archive.ubuntu.com/ubuntu/ precise/universe htop 1.0.1-1 (dsc) [1,112 B]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/universe htop 1.0.1-1 (tar) [385 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/universe htop 1.0.1-1 (diff) [9,113 B]
Fetched 395 kB in 0s (1,221 kB/s)
gpgv: Signature made Sun 19 Feb 2012 08:29:27 GMT using DSA key ID C154998C
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./htop_1.0.1-1.dsc
dpkg-source: info: extracting htop in htop-1.0.1
dpkg-source: info: unpacking htop_1.0.1.orig.tar.gz
dpkg-source: info: applying htop_1.0.1-1.diff.gz
My question now is: Where do I find the source code that I've just downloaded?
 
Old 12-26-2012, 02:00 PM   #9
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 133Reputation: 133
They'll be in the same directory where you entered apt-get source package. Just type pwd (print working directory). If you just opened a terminal and entered the command, they'll probably be in your home directory. They are already unpacked, so look for a directory named appname-version, e.g. htop-1.0.
 
1 members found this post helpful.
Old 12-26-2012, 02:25 PM   #10
dodo101
LQ Newbie
 
Registered: Dec 2012
Distribution: Mint
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kabamaru View Post
They'll be in the same directory where you entered apt-get source package. Just type pwd (print working directory). If you just opened a terminal and entered the command, they'll probably be in your home directory. They are already unpacked, so look for a directory named appname-version, e.g. htop-1.0.
You are right, I found them in my home directory. Thank you very much for all your support. My issue is now solved and a lot quicker than I expected! Thanks again for everyone who replied.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
source code for application installed thru apt-get sg08 Linux - Software 11 05-06-2010 03:21 PM
How to compile application source code on Ubuntu using terminal DirectHit Linux - Newbie 15 09-23-2009 05:21 PM
SuSE 10.1 will not install any application source code. Where is it? tiger9999tiger SUSE / openSUSE 2 07-02-2006 03:33 PM
accessing source code of Red hat linux rmmurugan Linux - General 2 05-22-2006 09:42 AM
Install application from source code UltraSoul Linux - Software 2 07-29-2005 02:23 PM


All times are GMT -5. The time now is 04:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration