the accepted answer from @ m0ntassar works, but it will uncomment all the lines starting with # deb that can open access to repositories that you don't need - or need -access to.
Instead, I would recommend the following targeting lines:
- Lines starting with
deb but commented out with # as follows: # deb . - And lines that end with
partner .
So my suggested Sed command would be as follows:
sed -e "/^#.*deb.*partner$/s/^# //g" /etc/apt/sources.list
This command with the -e command will show you the output, but the -i flag will edit the file in place:
sudo sed -i "/^#.*deb.*partner$/s/^# //g" /etc/apt/sources.list
Running it as sudo in this example, since in-place editing will require sudo rights.
source share