Printing in linux.docx

1
Printing The lpr command prints a document on Linux. You might not always invoke this command directly — you may just press a Print button on some glitzy drag- and-drop graphical interface — but ultimately, printing is handled by lpr and the other print- management utilities we'll describe here. If you want to print a program listing, you might enter: lpr myprogram.c Input is also often piped to lpr from another command, as we will see later. lpr starts the printing process by storing the data temporarily to a directory called a print spool. Other parts of the print management system, which we showed you how to set up in Section 8.4 in Section 8.1, remove files from the print queue in the correct order, process the files for printing, and control the flow of data to the printer. There is at least one print spool for each printer on the system.2 By default, lpr looks for a printer named lp. But if you need to specify a printer of a different name, just include a -P option. For example, to send your document to a printer named nene, enter: lpr -Pnene myprogram.c If you forget the name of a printer, you can look at the names of the spool directories under the /var/spool/lpd directory or at the /etc/printcap file entries to see all the names recognized for each printer. If you are using the lprng system (which many distributions do these days), you can also use lpq -a to see all installed printers.

Transcript of Printing in linux.docx

Page 1: Printing in linux.docx

PrintingThe lpr command prints a document on Linux. You might not always invoke this commanddirectly — you may just press a Print button on some glitzy drag-and-drop graphical interface— but ultimately, printing is handled by lpr and the other print-management utilities we'lldescribe here.If you want to print a program listing, you might enter:lpr myprogram.c

Input is also often piped to lpr from another command, as we will see later. lpr starts theprinting process by storing the data temporarily to a directory called a print spool. Other partsof the print management system, which we showed you how to set up in Section 8.4 inSection 8.1, remove files from the print queue in the correct order, process the files forprinting, and control the flow of data to the printer.There is at least one print spool for each printer on the system.2 By default, lpr looks for aprinter named lp. But if you need to specify a printer of a different name, just include a -Poption.For example, to send your document to a printer named nene, enter:lpr -Pnene myprogram.c

If you forget the name of a printer, you can look at the names of the spool directories underthe /var/spool/lpd directory or at the /etc/printcap file entries to see all the names recognizedfor each printer. If you are using the lprng system (which many distributions do these days),you can also use lpq -a to see all installed printers.