Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Shell script to delete all printers Printers
The following shell script will delete all printers. Make sure the file is executable after you create it (chmod ugo+x /path/to/delPrinters.sh).


#!/bin/sh

for printer in `lpstat -p | awk '{print $2}'`
do
echo Deleting $printer
lpadmin -x $printer
done
    •    
  • Currently 2.57 / 5
  You rated: 4 / 5 (7 votes cast)
 
[7,359 views]  

Shell script to delete all printers | 3 comments | Create New Account
Click here to return to the 'Shell script to delete all printers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Shell script to delete all printers
Authored by: benwiggy on Oct 11, '13 08:44:52AM

Why not just Reset the Printing System (right-click on a print queue in System Prefs > Print & Fax) ....?



[ Reply to This | # ]
Shell script to delete all printers
Authored by: poenn on Oct 11, '13 08:59:20AM

Ninja’d by benwiggy. :-) The CLI procedure has its place, i.e. if you need to mass-apply this using remote management tools.



[ Reply to This | # ]
Shell script to delete all printers
Authored by: poenn on Oct 11, '13 08:56:12AM

Nice. For those who prefer the GUI: Right-click in the white space where your printers are listed in SysPrefs/Printers and then select 'Reset printing system'.



[ Reply to This | # ]