Linux: Acquiring Source Code: Difference between revisions

From BS Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
#:::<code>deb-src <nowiki>http://us.archive.ubuntu.com/ubuntu/</nowiki> hirsute main restricted</code>
#:::<code>deb-src <nowiki>http://us.archive.ubuntu.com/ubuntu/</nowiki> hirsute main restricted</code>
# Update the new package information that was added in step 1
# Update the new package information that was added in step 1
:::<code>sudo apt-get update</code>
#:::<code>sudo apt-get update</code>
# Navigate to the directory that the source code will reside in, and download it.
# Navigate to the directory that the source code will reside in, and download it.
::Example for downloading the source code for the grep utility
#::Example for downloading the source code for the grep utility
:::<code>sudo apt-get source grep</code>
#:::<code>sudo apt-get source grep</code>
::Example for downloading the source code for bash
#::Example for downloading the source code for bash
:::<code>sudo apt-get source bash</code>
#:::<code>sudo apt-get source bash</code>
# There should be a directory with the source code along with some other files. Move to the new directory to view the downloaded source code.
# There should be a directory with the source code along with some other files. Move to the new directory to view the downloaded source code.


----
----

Revision as of 15:47, 9 May 2021

Acquiring Source Code in Ubuntu

  1. Update/enable the source package URLs. Note that in Ubuntu, these should already be in the sources.list file and just need to be uncommented. i.e. remove the "#" from the deb-src lines
    sudo gedit /etc/apt/sources.list
    An example line might look like this:
    deb-src http://us.archive.ubuntu.com/ubuntu/ hirsute main restricted
  2. Update the new package information that was added in step 1
    sudo apt-get update
  3. Navigate to the directory that the source code will reside in, and download it.
    Example for downloading the source code for the grep utility
    sudo apt-get source grep
    Example for downloading the source code for bash
    sudo apt-get source bash
  4. There should be a directory with the source code along with some other files. Move to the new directory to view the downloaded source code.