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

What uses does D&D 5e have for a d100?

Explicit #include vs. Implicit #include

I have found ports on my Samsung smart tv running a display service. What can I do with it?

Catching a robber on one line

How can I detect if I'm in a subshell?

Converting 3x7 to a 1x7. Is it possible with only existing parts?

How to sort human readable size

How do credit card companies know what type of business I'm paying for?

Will users know a CardView is clickable

How to make a villain when your PCs are villains?

What kind of chart is this?

100-doors puzzle

How did Avada Kedavra get its name?

My husband's visa refused but mine wasn't -- can I travel?

How to address players struggling with simple controls?

Why is Skinner so awkward in Hot Fuzz?

Sci-fi series about a mercenary with a spaceship with AI

2 Managed Packages in 1 Dev Org

Is there a risk to write an invitation letter for a stranger to obtain a Czech (Schengen) visa?

How can the US president give an order to a civilian?

How do CMB photons 'gain energy when they pass through normal regions of space with matter' and 'lose energy when they pass through voids'?

What are the mechanical differences between Adapt and Monstrosity?

How to make all magic-casting innate, but still rare?

Co-worker is now managing my team. Does this mean that I'm being demoted?



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;








16















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



















  • 1





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

    – Rinzwind
    May 30 at 19:05






  • 2





    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
    May 30 at 19:56






  • 1





    Understood, retracted :)

    – NGRhodes
    May 30 at 20:08

















16















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



















  • 1





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

    – Rinzwind
    May 30 at 19:05






  • 2





    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
    May 30 at 19:56






  • 1





    Understood, retracted :)

    – NGRhodes
    May 30 at 20:08













16












16








16








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
















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















share|improve this question













share|improve this question




share|improve this question








edited May 30 at 18:41









George Udosen

22.7k105277




22.7k105277










asked May 30 at 18:39









jonaslbjonaslb

834




834







  • 1





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

    – Rinzwind
    May 30 at 19:05






  • 2





    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
    May 30 at 19:56






  • 1





    Understood, retracted :)

    – NGRhodes
    May 30 at 20:08












  • 1





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

    – Rinzwind
    May 30 at 19:05






  • 2





    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
    May 30 at 19:56






  • 1





    Understood, retracted :)

    – NGRhodes
    May 30 at 20:08







1




1





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

– Rinzwind
May 30 at 19:05





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

– Rinzwind
May 30 at 19:05




2




2





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
May 30 at 19:56





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
May 30 at 19:56




1




1





Understood, retracted :)

– NGRhodes
May 30 at 20:08





Understood, retracted :)

– NGRhodes
May 30 at 20:08










1 Answer
1






active

oldest

votes


















13














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
    May 30 at 20:42











  • 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
    May 30 at 20:46







  • 1





    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
    May 30 at 20:56











  • Great work and glad it worked!

    – George Udosen
    May 30 at 20:57











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
);



);













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









13














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
    May 30 at 20:42











  • 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
    May 30 at 20:46







  • 1





    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
    May 30 at 20:56











  • Great work and glad it worked!

    – George Udosen
    May 30 at 20:57















13














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
    May 30 at 20:42











  • 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
    May 30 at 20:46







  • 1





    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
    May 30 at 20:56











  • Great work and glad it worked!

    – George Udosen
    May 30 at 20:57













13












13








13







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 May 30 at 21:19









Jos

15.2k54554




15.2k54554










answered May 30 at 19:28









George UdosenGeorge Udosen

22.7k105277




22.7k105277












  • 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
    May 30 at 20:42











  • 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
    May 30 at 20:46







  • 1





    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
    May 30 at 20:56











  • Great work and glad it worked!

    – George Udosen
    May 30 at 20:57

















  • 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
    May 30 at 20:42











  • 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
    May 30 at 20:46







  • 1





    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
    May 30 at 20:56











  • Great work and glad it worked!

    – George Udosen
    May 30 at 20:57
















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
May 30 at 20:42





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
May 30 at 20:42













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
May 30 at 20:46






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
May 30 at 20:46





1




1





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
May 30 at 20:56





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
May 30 at 20:56













Great work and glad it worked!

– George Udosen
May 30 at 20:57





Great work and glad it worked!

– George Udosen
May 30 at 20:57

















draft saved

draft discarded
















































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

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos