Enable Software from Cli

Enable Software from Cli

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

5

1 Answer

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
       format:

           deb  xenial main restricted
           deb  xenial-security main restricted
           deb  xenial-updates main restricted

       or like this in deb822 style format:

           Types: deb
           URIs: 
           Suites: xenial xenial-updates
           Components: main restricted

           Types: deb
           URIs: 
           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  bionic main restricted

Line 16 has one component i.e., universe

deb  bionic universe

Line 26 has one component i.e., multiverse

deb  bionic multiverse

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

# deb-src  bionic main restricted

Observations:

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..

Your Answer

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

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.