Printing from the Command Line (and emacs)

Table of Contents

Helpful Resource: https://www.cyberciti.biz/tips/linux-unix-sets-the-page-size-to-size.html

Command Note
lp print with good defaults
lpc status all See printer settings
lprm clear print jobs
export PRINTER='Sharp-MX-2700N’ Set the target printer before printing
lpoptions See available options

I generally print PDFs, using the excellent pdf-tools. This provides C-c C-p which will print with the $PRINTER and settings you’ve configured, but sometimes you need more customization.

Example: print letter with two sides

lp -d hpljf2 -o media=letter -o sides=two-sided-long-edge /path/to/file

Fit to page with no margins

lp -o page-left=0 -o page-right=0 -o fit-to-page 2019_W2.pdf 
Tory Anderson avatar
Tory Anderson
Full-time Web App Engineer, Digital Humanist, Researcher, Computer Psychologist