Printing from within an application is very easy, selecting the Print option from the menu.
From the command line, use the lp or lpr command.
lp file(s)
lpr file(s)
These commands can read from a pipe, so you can print the output of commands using
command | lp
There are many options available to tune the page layout, the number of copies, the printer that you want to print to if you have more than one available, paper size, one-side or double-sided printing if your printer supports this feature, margins and so on. Read the man pages for a complete overview.
Once the file is accepted in the print queue, an identification number for the print job is assigned:
davy:~> lp /etc/profile request id is blob-253 (1 file(s))
To view (query) the print queue, use the lpq or lpstat command. When entered without arguments, it displays the contents of the default print queue.
davy:~> lpq blob is ready and printing Rank Owner Job File(s) Total Size active davy 253 profile 1024 bytes davy:~> lpstat blob-253 davy 1024 Tue 25 Jul 2006 10:20_01 AM CEST
Which is the default printer on a system that has access to multiple printers?
lpstat -d
davy:~> lpstat -d system default destination: blob
What is the status of my printer(s)?
lpstat -p
davy:~> lpstat -p printer blob now printing blob-253. enabled since Jan 01 18:01
If you don't like what you see from the status commands, use lprm or cancel to delete jobs.
davy:~> lprm 253
In the graphical environment, you may see a popup window telling you that the job has been canceled.
In larger environments, lpc may be used to control multiple printers. See the Info or man pages on each command.
There are many GUI print tools used as a front-end to lp, and most graphical applications have a print function that uses lp. See the built-in Help functions and program specific documentation for more.
If we want to get something sensible out of the printer, files should be formatted first. Apart from an abundance of formatting software, Linux comes with the basic UNIX formatting tools and languages.
Modern Linux systems support direct printing, without any formatting by the user, of a range of file types: text, PDF, PostScript and several image formats like PNG, JPEG, BMP and GIF.
For those file formats that do need formatting, Linux comes with a lot of formatting tools, such as the pdf2ps, fax2ps and a2ps commands, that convert other formats to PostScript. These commands can create files that can then be used on other systems that don't have all the conversion tools installed.
Apart from these command line tools there are a lot of graphical word processing programs. Several complete office suites are available, many are free. These do the formatting automatically upon submission of a print job. Just to name a few: OpenOffice, KOffice, AbiWord, WordPerfect, etc.
The following are common languages in a printing context:
-t option to the man command: man -t command > man-command.ps Then print the PostScript file. If a default print destination is configured for your system/account, you can just issue the command man -t command to send the formatted page to the printer directly. For printing Info pages, refer to the Info pages on info (you will need the source code of the command).Anything that you can send to the printer can normally be sent to the screen as well. Depending on the file format, you can use one of these commands: