Tuesday, 19 June 2012

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
1. Finding an existing PPD for your printer if required:
  • lpinfo --make-and-model 'LaserJet 3390' -m
2. 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
3. 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

No comments:

Post a Comment