An Ubuntu 14.04 which I have been maintaining has a lot of non-working printer configurations. I'd like to purge it all and configure only the working ones from the scratch. Any ideas to remove them all preferably via command line?

2 Answers 2


Stop cupsd:
sudo stop cups
then edit the printer configuration:

sudo cp /etc/cups/printers.conf /etc/cups/printers.conf.backup
sudo nano /etc/cups/printers.conf

Remove all printer information and save.

  • 2
    For anyone stumbling across this: now you have to do "systemctl stop cups"
    – Daniel
    Apr 19, 2020 at 12:45
  • 1
    Agreed, we didn't have systemd in 2014 :-)
    – Jos
    Apr 19, 2020 at 15:10

This post was first search result on google for me while searching for a way to remove all printers from cups. I'm adding answer from another forum, that I found useful.

Edit 1: Found a small bug while using this command, lpstat -p sometimes print multiple lines for one printer eg.

printer kyocera01 disabled since Št 22. apríl 2021, 12:13:31 -
    reason unknown

To fix this, pipe lpstat -p output to grep '^printer' before piping to cut, to filter lines containing printer names.

lpstat -p | grep '^printer' | cut -d' ' -f2

Original answer:

lpstat -p | cut -d' ' -f2 | xargs -I{} lpadmin -x {}

This way you can also filter printers with grep.

lpstat -p | cut -d' ' -f2 | grep mcx | xargs -I{} lpadmin -x {}

Link to original post: https://www.jamf.com/jamf-nation/discussions/11980/removing-printers-with-a-script

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .