How do I remove hundreds of automatically added network printers?Why is it necessary to add locally attached...

How to apply the "glow" effect to a rectangle with tcolorbox?

Will TSA allow me to carry a Continuous Positive Airway Pressure (CPAP) device?

Does Peach's float negate shorthop knockback multipliers?

What is the right way to float a home lab?

Hygienic footwear for prehensile feet?

Chopin: marche funèbre bar 15 impossible place

Pros and cons of writing a book review?

Creating Fictional Slavic Place Names

Is the decompression of compressed and encrypted data without decryption also theoretically impossible?

Strange math syntax in old basic listing

PhD student with mental health issues and bad performance

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

The term for the person/group a political party aligns themselves with to appear concerned about the general public

Is it a problem that pull requests are approved without any comments

How to detach yourself from a character you're going to kill?

Explain Ant-Man's "not it" scene from Avengers: Endgame

When leasing/renting out an owned property, is there a standard ratio between monthly rent and the mortgage?

Applicants clearly not having the skills they advertise

What if you don't bring your credit card or debit for incidentals?

Why does MS SQL allow you to create an illegal column?

Did Darth Vader wear the same suit for 20+ years?

Concise way to draw this pyramid

What is the Process for Re-certifying Flight Hardware?

What is the best option to connect old computer to modern TV



How do I remove hundreds of automatically added network printers?


Why is it necessary to add locally attached printers?How to re-share a printer (adding extra queue?)Lack of printer driversall network printers are automatically listedlubuntu 16.04 add network printercannot stop network printers are being automatically addedprinting using a HP Deskjet 1000 j110a connected via USB to a Starbridge 1531 Router using Ubuntu 16.04Canon Printer “Does not accept Jobs” on Ubuntu 18.04Can't Detect HP Printer with HPLIPDoubled Printers in Settings/Devices/Printers






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







6















It is very difficult for me to perform printing, because the printer dialogue is full of hundreds of automatically added printers, so I can't find the one I want to use, see screenshot below.



Image of printer dialogue showing a very long scroll bar



The printers stem from my work network, where apparently lots of people (including students, I guess) are "sharing" their home printers, which my laptop then picks up automatically. (coincidentally I sometimes disable the avahi-daemon at work, simply because it is using a large amount of CPU).



When I go to http://localhost:631/printers/, it says there are 131 printers, and they are all of Make and Model 'Local Raw Printer'. With two exceptions: 1 is a network printer at work that I manually configured. Another is a network printer at my parents', which was also automatically added and which I am on the same network as right now. But the rest are just garbage that I would really like to avoid. Tips on how to do that would be appreciated.



I will not be going back to my work place for a bit of time though, so for now, I would just like these printers (that would be the 129/130 automatically added printers) to be removed. Is there a way to do that? I guess I could do it by clicking through in the cups web interface, but for 129 printers, that is a bit much. So I am looking for a single command or tips on how to achieve it with a script of sorts.










share|improve this question









New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    see /etc/cups/printers.conf. stop cups and then remove the printers from the file.

    – Rinzwind
    8 hours ago






  • 1





    It's not a duplicate because I am asking how to remove already installed printers, while that other question is about preventing their installation. Also, it's a question which has a hot mess of outdated answers which don't work. I know this because I've seen it before and tried some of it.

    – jonaslb
    8 hours ago











  • Understood, retracted :)

    – NGRhodes
    7 hours ago


















6















It is very difficult for me to perform printing, because the printer dialogue is full of hundreds of automatically added printers, so I can't find the one I want to use, see screenshot below.



Image of printer dialogue showing a very long scroll bar



The printers stem from my work network, where apparently lots of people (including students, I guess) are "sharing" their home printers, which my laptop then picks up automatically. (coincidentally I sometimes disable the avahi-daemon at work, simply because it is using a large amount of CPU).



When I go to http://localhost:631/printers/, it says there are 131 printers, and they are all of Make and Model 'Local Raw Printer'. With two exceptions: 1 is a network printer at work that I manually configured. Another is a network printer at my parents', which was also automatically added and which I am on the same network as right now. But the rest are just garbage that I would really like to avoid. Tips on how to do that would be appreciated.



I will not be going back to my work place for a bit of time though, so for now, I would just like these printers (that would be the 129/130 automatically added printers) to be removed. Is there a way to do that? I guess I could do it by clicking through in the cups web interface, but for 129 printers, that is a bit much. So I am looking for a single command or tips on how to achieve it with a script of sorts.










share|improve this question









New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    see /etc/cups/printers.conf. stop cups and then remove the printers from the file.

    – Rinzwind
    8 hours ago






  • 1





    It's not a duplicate because I am asking how to remove already installed printers, while that other question is about preventing their installation. Also, it's a question which has a hot mess of outdated answers which don't work. I know this because I've seen it before and tried some of it.

    – jonaslb
    8 hours ago











  • Understood, retracted :)

    – NGRhodes
    7 hours ago














6












6








6








It is very difficult for me to perform printing, because the printer dialogue is full of hundreds of automatically added printers, so I can't find the one I want to use, see screenshot below.



Image of printer dialogue showing a very long scroll bar



The printers stem from my work network, where apparently lots of people (including students, I guess) are "sharing" their home printers, which my laptop then picks up automatically. (coincidentally I sometimes disable the avahi-daemon at work, simply because it is using a large amount of CPU).



When I go to http://localhost:631/printers/, it says there are 131 printers, and they are all of Make and Model 'Local Raw Printer'. With two exceptions: 1 is a network printer at work that I manually configured. Another is a network printer at my parents', which was also automatically added and which I am on the same network as right now. But the rest are just garbage that I would really like to avoid. Tips on how to do that would be appreciated.



I will not be going back to my work place for a bit of time though, so for now, I would just like these printers (that would be the 129/130 automatically added printers) to be removed. Is there a way to do that? I guess I could do it by clicking through in the cups web interface, but for 129 printers, that is a bit much. So I am looking for a single command or tips on how to achieve it with a script of sorts.










share|improve this question









New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











It is very difficult for me to perform printing, because the printer dialogue is full of hundreds of automatically added printers, so I can't find the one I want to use, see screenshot below.



Image of printer dialogue showing a very long scroll bar



The printers stem from my work network, where apparently lots of people (including students, I guess) are "sharing" their home printers, which my laptop then picks up automatically. (coincidentally I sometimes disable the avahi-daemon at work, simply because it is using a large amount of CPU).



When I go to http://localhost:631/printers/, it says there are 131 printers, and they are all of Make and Model 'Local Raw Printer'. With two exceptions: 1 is a network printer at work that I manually configured. Another is a network printer at my parents', which was also automatically added and which I am on the same network as right now. But the rest are just garbage that I would really like to avoid. Tips on how to do that would be appreciated.



I will not be going back to my work place for a bit of time though, so for now, I would just like these printers (that would be the 129/130 automatically added printers) to be removed. Is there a way to do that? I guess I could do it by clicking through in the cups web interface, but for 129 printers, that is a bit much. So I am looking for a single command or tips on how to achieve it with a script of sorts.







networking printing avahi






share|improve this question









New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 9 hours ago









George Udosen

22.4k104875




22.4k104875






New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 9 hours ago









jonaslbjonaslb

332




332




New contributor



jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




jonaslb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










  • 1





    see /etc/cups/printers.conf. stop cups and then remove the printers from the file.

    – Rinzwind
    8 hours ago






  • 1





    It's not a duplicate because I am asking how to remove already installed printers, while that other question is about preventing their installation. Also, it's a question which has a hot mess of outdated answers which don't work. I know this because I've seen it before and tried some of it.

    – jonaslb
    8 hours ago











  • Understood, retracted :)

    – NGRhodes
    7 hours ago














  • 1





    see /etc/cups/printers.conf. stop cups and then remove the printers from the file.

    – Rinzwind
    8 hours ago






  • 1





    It's not a duplicate because I am asking how to remove already installed printers, while that other question is about preventing their installation. Also, it's a question which has a hot mess of outdated answers which don't work. I know this because I've seen it before and tried some of it.

    – jonaslb
    8 hours ago











  • Understood, retracted :)

    – NGRhodes
    7 hours ago








1




1





see /etc/cups/printers.conf. stop cups and then remove the printers from the file.

– Rinzwind
8 hours ago





see /etc/cups/printers.conf. stop cups and then remove the printers from the file.

– Rinzwind
8 hours ago




1




1





It's not a duplicate because I am asking how to remove already installed printers, while that other question is about preventing their installation. Also, it's a question which has a hot mess of outdated answers which don't work. I know this because I've seen it before and tried some of it.

– jonaslb
8 hours ago





It's not a duplicate because I am asking how to remove already installed printers, while that other question is about preventing their installation. Also, it's a question which has a hot mess of outdated answers which don't work. I know this because I've seen it before and tried some of it.

– jonaslb
8 hours ago













Understood, retracted :)

– NGRhodes
7 hours ago





Understood, retracted :)

– NGRhodes
7 hours ago










1 Answer
1






active

oldest

votes


















6














Using this command: lpstat -a we can see the installed printers and identify the name of the desired printer to keep, we can use the grep command also to filter the results like so: lpstat -a | grep <probable_name_of_printer>.



Then this little script can help:





  1. Run this command to check that the desired printer is not listed:



    lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d' | grep <NAME_OF_PRINTER>




    • This should return nothing as it does the following:





      • lpstat -a: list installed printers


      • cut -d" " -f1: return only the names of the printers


      • sed -E '/<NAME_OF_PRINTER>/d': remove the name of the printer to keep from the output of the previous commands


      • grep <NAME_OF_PRINTER>: make sure the desired printer is not on the list






  2. If the above checks out; then run this command to remove every other printer that you don't need:



    sudo bash -c 'for i in $(lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d'); do lpadmin -x "$i"; done'







share|improve this answer


























  • This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

    – jonaslb
    7 hours ago











  • Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

    – George Udosen
    7 hours ago













  • It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

    – jonaslb
    7 hours ago











  • Great work and glad it worked!

    – George Udosen
    7 hours ago












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






jonaslb is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147493%2fhow-do-i-remove-hundreds-of-automatically-added-network-printers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














Using this command: lpstat -a we can see the installed printers and identify the name of the desired printer to keep, we can use the grep command also to filter the results like so: lpstat -a | grep <probable_name_of_printer>.



Then this little script can help:





  1. Run this command to check that the desired printer is not listed:



    lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d' | grep <NAME_OF_PRINTER>




    • This should return nothing as it does the following:





      • lpstat -a: list installed printers


      • cut -d" " -f1: return only the names of the printers


      • sed -E '/<NAME_OF_PRINTER>/d': remove the name of the printer to keep from the output of the previous commands


      • grep <NAME_OF_PRINTER>: make sure the desired printer is not on the list






  2. If the above checks out; then run this command to remove every other printer that you don't need:



    sudo bash -c 'for i in $(lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d'); do lpadmin -x "$i"; done'







share|improve this answer


























  • This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

    – jonaslb
    7 hours ago











  • Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

    – George Udosen
    7 hours ago













  • It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

    – jonaslb
    7 hours ago











  • Great work and glad it worked!

    – George Udosen
    7 hours ago
















6














Using this command: lpstat -a we can see the installed printers and identify the name of the desired printer to keep, we can use the grep command also to filter the results like so: lpstat -a | grep <probable_name_of_printer>.



Then this little script can help:





  1. Run this command to check that the desired printer is not listed:



    lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d' | grep <NAME_OF_PRINTER>




    • This should return nothing as it does the following:





      • lpstat -a: list installed printers


      • cut -d" " -f1: return only the names of the printers


      • sed -E '/<NAME_OF_PRINTER>/d': remove the name of the printer to keep from the output of the previous commands


      • grep <NAME_OF_PRINTER>: make sure the desired printer is not on the list






  2. If the above checks out; then run this command to remove every other printer that you don't need:



    sudo bash -c 'for i in $(lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d'); do lpadmin -x "$i"; done'







share|improve this answer


























  • This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

    – jonaslb
    7 hours ago











  • Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

    – George Udosen
    7 hours ago













  • It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

    – jonaslb
    7 hours ago











  • Great work and glad it worked!

    – George Udosen
    7 hours ago














6












6








6







Using this command: lpstat -a we can see the installed printers and identify the name of the desired printer to keep, we can use the grep command also to filter the results like so: lpstat -a | grep <probable_name_of_printer>.



Then this little script can help:





  1. Run this command to check that the desired printer is not listed:



    lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d' | grep <NAME_OF_PRINTER>




    • This should return nothing as it does the following:





      • lpstat -a: list installed printers


      • cut -d" " -f1: return only the names of the printers


      • sed -E '/<NAME_OF_PRINTER>/d': remove the name of the printer to keep from the output of the previous commands


      • grep <NAME_OF_PRINTER>: make sure the desired printer is not on the list






  2. If the above checks out; then run this command to remove every other printer that you don't need:



    sudo bash -c 'for i in $(lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d'); do lpadmin -x "$i"; done'







share|improve this answer















Using this command: lpstat -a we can see the installed printers and identify the name of the desired printer to keep, we can use the grep command also to filter the results like so: lpstat -a | grep <probable_name_of_printer>.



Then this little script can help:





  1. Run this command to check that the desired printer is not listed:



    lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d' | grep <NAME_OF_PRINTER>




    • This should return nothing as it does the following:





      • lpstat -a: list installed printers


      • cut -d" " -f1: return only the names of the printers


      • sed -E '/<NAME_OF_PRINTER>/d': remove the name of the printer to keep from the output of the previous commands


      • grep <NAME_OF_PRINTER>: make sure the desired printer is not on the list






  2. If the above checks out; then run this command to remove every other printer that you don't need:



    sudo bash -c 'for i in $(lpstat -a | cut -d" " -f1 | sed -E '/<NAME_OF_PRINTER>/d'); do lpadmin -x "$i"; done'








share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago









Jos

15.1k54554




15.1k54554










answered 8 hours ago









George UdosenGeorge Udosen

22.4k104875




22.4k104875













  • This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

    – jonaslb
    7 hours ago











  • Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

    – George Udosen
    7 hours ago













  • It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

    – jonaslb
    7 hours ago











  • Great work and glad it worked!

    – George Udosen
    7 hours ago



















  • This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

    – jonaslb
    7 hours ago











  • Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

    – George Udosen
    7 hours ago













  • It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

    – jonaslb
    7 hours ago











  • Great work and glad it worked!

    – George Udosen
    7 hours ago

















This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

– jonaslb
7 hours ago





This looks promising. I think there might be an issue though (with the listing command so presumably also the last command). lpstat -a results in <printer_name> not accepting request since <some date> -n reason unknown (with reason unknown on a new line!). So using your listing command I get a lot of "printers" named ` reason` (there's an indentation).

– jonaslb
7 hours ago













Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

– George Udosen
7 hours ago







Please which part of the steps are you having issues and add any results to your question so I can follow! What does the command lpstat -a give you?

– George Udosen
7 hours ago















It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

– jonaslb
7 hours ago





It worked fine, but I added another sed command in the "pipe chain": sed -E /reason/d to be rid of the extra lines.

– jonaslb
7 hours ago













Great work and glad it worked!

– George Udosen
7 hours ago





Great work and glad it worked!

– George Udosen
7 hours ago










jonaslb is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















jonaslb is a new contributor. Be nice, and check out our Code of Conduct.













jonaslb is a new contributor. Be nice, and check out our Code of Conduct.












jonaslb is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147493%2fhow-do-i-remove-hundreds-of-automatically-added-network-printers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...