Skip to content

Instantly share code, notes, and snippets.

@wagnermarques
Created January 21, 2016 16:48
Show Gist options
  • Save wagnermarques/5482d4bdce805698484f to your computer and use it in GitHub Desktop.
Save wagnermarques/5482d4bdce805698484f to your computer and use it in GitHub Desktop.
#!/bin/bash
#get default printer
#http://www.thegeekstuff.com/2015/01/lpadmin-examples/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+TheGeekStuff+%28The+Geek+Stuff%29
#http://aplawrence.com/Unixart/cups_sysv_interface.html
echo "default printer from printer.conf"
cat /etc/cups/printers.conf | grep DefaultPrinter | awk '{ print $2 }' | sed 's/>//g'
echo "default printer from lpstat -d"
cat lpstat -d | awk '{print $4}'
echo "list all printers"
lpstat -p | grep printer | awk '{print $2}'
echo "list printers that area accepting jobs"
lpstat -a | awk '{print $1}'
echo "list printers"
lpstat -p -d | grep ^printer | awk '{print $2}'
#-d Shows the current default destination.
#-p [printer(s)]
# Shows the printers and whether they are enabled for printing. If no printers are specified then all printers are listed.
#
https://localhost:631/printers/%5BNameOfPrinter%5D?which_jobs=completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment