The print spooler comes with several clients for communicating with the
server daemon. The one you're likely to use most often is lpr, which
simply sends a file to the server to be queued up in a print spool and
then printed. To try it out, first find or make a small sample text file.
Then:
$ lpr sample.txt
If it worked, you shouldn't see any response on the screen, but your
printer should start going, and soon you'll have a hard copy of your
sample text. Don't worry if it doesn't come out looking quite right;
we'll set up filters a bit later that should ensure that all sorts of file
formats print correctly.
You can examine the list of print jobs in the print spool queue with
the lpq command. The -P option specifies the
name of the queue to display; if you leave it off, lpq will use the
default spool, just like lpr did before:
$ lpq -Plp
Printer: lp@localhost 'Generic dot-matrix printer entry'
Queue: 1 printable job
Server: pid 1671 active
Unspooler: pid 1672 active
Rank Owner/ID Class Job Files Size Time
active chouser@localhost+670 A 670 sample.txt 8 21:57:30
If you want to stop a job from printing, use the lprm command. You
might want to do this if a job is taking to long, or if a user
accidentally sends the same file more than once. Just copy the job id
from the lpq listing above:
$ lprm chouser@localhost+670
Printer lp@localhost:
checking perms 'chouser@localhost+670'
dequeued 'chouser@localhost+670'
You can do many other operations on a print spool using the interactive
tool lpc. See the lpc man page for details.