Skip to content

Instantly share code, notes, and snippets.

@mcnemesis
Last active December 20, 2015 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcnemesis/6120378 to your computer and use it in GitHub Desktop.
Save mcnemesis/6120378 to your computer and use it in GitHub Desktop.
A CUPS Cheetsheet (under development) Originally based on the blog post: http://www.mybinarylife.net/2012/06/linux-cups-terminal-printer-quick.html
Linux CUPS terminal printer quick cheatsheet
=============================================
** Adding a new printer without a PPD:
lpadmin -p printer_name -E -v socket://192.168.1.9:9100
** Finding an existing PPD for your printer if required:
lpinfo --make-and-model 'LaserJet 3390' -m
* Copy the require line up to the first space, eg from above command:
Output: gutenprint.5.2://hp-lj_3390/expert HP LaserJet 3390 - CUPS
Used for -m: gutenprint.5.2://hp-lj_3390/expert
* Adding a new printer with above ppd:
lpadmin -p printer_name -E -v smb://user:pass@192.168.1.9/printer_name -m gutenprint.5.2://hp-lj_3390/expert
** Adding a new printer with a specific ppd:
lpadmin -p printer_name -E -v serial:/dev/ttyS0?baud=115200 -m MyPrinter.ppd
** Adding Location (-L) and Description (-D):
lpadmin -p printer_name -L "13th floor" -D "Konica Minolta C250"
** Setting printer as default:
lpoptions -d printer_name
** Printing a file eg. /etc/hosts:
lpr -P printer_name /etc/hosts
** Remove the printer from the system:
lpadmin -x printer_name
** View printer state and job list:
lpq -P printer_name
** View status information for jobs for a specific printer:
lpstat -P printer_name
** Purge all jobs for a specific printer:
lprm - -P printer_name
** Enabling a stopped printer:
cupsenable printer_name
** Disabling a printer:
cupsdisable printer_name
** Some of the lpadmin -v types:
serial:/dev/ttyS0 (can add baud, eg: serial:/dev/ttyS0?baud=115200)
parallel:/dev/lp0
smb://user:pass@host/share
ipp://host:port/printer_name
lpd://host/printer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment