How do you enable these sources from the CLI? I cannot see which it is in /etc/apt/sources*

Software & Updates

  • Check this file /etc/apt/sources.list. To edit it you must have a root privileges. – mariaczi Oct 11 '19 at 13:49
  • Yes, but which commented out section refers to which check box here? – eekfonky Oct 11 '19 at 13:53
  • 1
    Lines with "deb-src" on the beginning regards to the sources packages in the repository. – mariaczi Oct 11 '19 at 13:57
  • in short.. you want to control (tick and untick) the tick mark in your attached pic from command line rite? – PRATAP Oct 11 '19 at 14:53
  • @PRATAP yes, exactly. I can easily remove the comments via a bash script, but I can't find them! Lol – eekfonky Oct 11 '19 at 15:01

According to man sources.list the main paragraph underTHE DEB AND DEB-SRC TYPES: GENERAL FORMAT and some examples in it says

As an example, the sources for your distribution could look like this in one-line-style

           deb http://us.archive.ubuntu.com/ubuntu xenial main restricted
           deb http://security.ubuntu.com/ubuntu xenial-security main restricted
           deb http://us.archive.ubuntu.com/ubuntu xenial-updates main restricted

       or like this in deb822 style format:

           Types: deb
           URIs: http://us.archive.ubuntu.com/ubuntu
           Suites: xenial xenial-updates
           Components: main restricted

           Types: deb
           URIs: http://security.ubuntu.com/ubuntu
           Suites: xenial-security
           Components: main restricted

Based on above:

and from the unedited /etc/apt/sources.list file from Ubuntu 18.04

Line 5 has two components i.e., main and restricted.

deb http://in.archive.ubuntu.com/ubuntu/ bionic main restricted

Line 16 has one component i.e., universe

deb http://in.archive.ubuntu.com/ubuntu/ bionic universe

Line 26 has one component i.e., multiverse

deb http://in.archive.ubuntu.com/ubuntu/ bionic multiverse

The 5th item in the attached pic, source code can be enabled by un-commenting the line number 6

# deb-src http://in.archive.ubuntu.com/ubuntu/ bionic main restricted


When you tick and untick these tick marks via GUI, the file /etc/apt/sources.list lines may vary.. like they dont uncomment the line, Instead they will add other line with some comment etc..

If you dont change those settings with GUI, you can always edit the file with scripts with constant line numbers..

So be careful with your scripts while defining the line numbers..

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.