#install cups lpr - This is different then the lpr stand alone package sudo apt install cups cups-bsd hplip # setup network printer lpadmin -p HP_PRINTER -E -v ipp://192.168.1.170/ipp/print -m everywhere # set default printer lpoptions -d HP_PRINTER #get a list of printers lpstat -p -d #if you don't have a default printer set for your system lpoptions -d "" #print to default printer lpr file.txt lpr file.pdf lpr file.png echo "Hello World"|lpr ls |lpr #choose printer to print to lpr -P "" file.txt ###Print to PDF### sudo apt install cups-pdf #print to pdf #output goes in ~/PDF lpr -P PDF file.txt #set job title lpr -P PDF -t My_Text_File file.txt #set PDF as default printer lpoptions -d "PDF" lpr -P PDF -t My_Text_File file.txt #set jobs and information lpstat -o lpstat -t #Cancel the current job on the default printer: lprm #Cancel job 1234: lprm 1234 #Cancel all jobs: lprm - ###print office document## #lpr can not print office docs #so we convert them to pdf first with unoconv sudo apt install unoconv unoconv --stdout /tmp/file.odt |lpr -P PDF -T Writer_Document unoconv --stdout /tmp/sheet.ods |lpr -P PDF -T Spread_Sheet