How to delete in terminal

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Level 1
Level 1
Posts: 1
Joined: Fri Jun 22, 2018 5:40 pm

How to delete in terminal

Post by GCG » Fri Jun 22, 2018 5:52 pm

I have been tracking down a solution for why the mint 18.2 update manager in my computer won't work. People have explained that is a non-working repository and an old bug of certain etiology.

I have found other posts about the issue yet no terminal command to fix it. I can't find anything in software sources that would let me remove it so I am looking at the terminal for the remedy.

This command in terminal-
inxi -r
shows the software sources (I believe). And at the top of the list is the that apparently is the stopper. Has anyone got a simple command to use in terminal that will remove it and let the update manager work?

Code: Select all

Repos: Active apt sources in file: /etc/apt/sources.list.d/additional-repositories.list
deb xenial main
Active apt sources in file: /etc/apt/sources.list.d/google-chrome.list
deb [arch=amd64] stable main
Active apt sources in file: /etc/apt/sources.list.d/official-package-repositories.list
deb sylvia main upstream import backport
deb xenial main restricted universe multiverse
deb xenial-updates main restricted universe multiverse
deb xenial-backports main restricted universe multiverse
deb xenial-security main restricted universe multiverse
deb xenial partner :)

Level 19
Level 19
Posts: 9962
Joined: Fri Feb 21, 2014 8:17 am

Re: How to delete in terminal

Post by JeremyB » Fri Jun 22, 2018 6:08 pm

I would

Code: Select all

sudo rm /etc/apt/sources.list.d/additional-repositories.list


Re: How to delete in terminal

Post by lmuserx4849 » Fri Jun 22, 2018 7:17 pm

When you remove a repository, do you also have to remove the key? See apt-key list and apt-key del KEY.

I thought it would be nice if one could see if the repositories still exist. I know the list should not be long, but sometimes things accumulate. I didn't find a native command, so I came up with:

Code: Select all

for url in $(apt-cache policy | awk '/http[^\s]/ { arr[$2] } END { for (x in arr) { print x } }'); do 
  result="$(curl -s --head "$url"|head -n1)";  printf -- '%-100s %s\n' "$url" "$result"; done
- capture the url from apt-cache policy.
- use the url in curl, where the first line is the http status code
- print the url and the status code

snippet of the output:
This only tells you it exists, not that it is valid. Argh, Ubuntu puts up the default "do nothing" Apache web page.

The command I've used is sudo add-apt-repository --remove SPECIFIC_PPA
manpage @Ubuntu
FYI: inxi gets its' info from ls /etc/apt/sources.list /etc/apt/sources.list.d/*.list

You might want to keep in mind, there is another command, ppa-purge. It will remove the PPA, as well as downgrade all the packages installed from that PPA

However, it might be easier if you use the GUI. Open up the Software Manager > Edit > Software Sources. When selecting a button on the left, you should be able to view and remove as needed. You can use this for repo security keys too. Notice, you can just disable it by unchecking the enable checkbox. This same window is also available under Synaptic Package Manager, under Settings >Repositories

Post Reply

Return to “Newbie Questions”