lpr
print files
see also :
cancel - lp - lpadmin - lpoptions - lpq - lprm - lpstat
Synopsis
lpr [ -E
] [ -H server[:port] ] [ -U username ] [ -P
destination[/instance] ] [ -# num-copies [ -h
] [ -l ] [ -m ] [ -o option[=value] ] [ -p] [ -q ] [
-r ] [ -C/J/T title ] [ file(s) ]
add an example, a script, a trick and tips
examples
source
Printing from the command line with LibreOffice, lpr commands?
You can't pass lpr
command line options to
libreoffice
. Two possible solutions are:
-
One step solution (the best solution in my opinion): use
unoconv outputting a PDF to
stdout
piped to lpr
:
$ unoconv --stdout filename.doc | lpr -U username -P the_printer_name
-
Three step solution (if you don't want / can't use
unoconv
): use libreoffice
--print-to-file
to a temporary file + lpr
of the file + delete the temporary file (unfortunatelly
libreoffice still doesn't support printing to
stdout):
$ libreoffice --headless --print-to-file --printer-name the_printer_name --outdir /tmp filename.doc
$ lpr -U username /tmp/filename.ps -P the_printer_name
$ rm /tmp/filename.ps
source
lpr -Plp evtmlib.c
lpr -Plp evtmlib.h
source
lpr -Plp timerlib.h
lpr -Plp timerlib.c
source
lpr -Plp tcplib.h
lpr -Plp tcplib.c
source
lpr -Plp cli.c
lpr -Plp ser.c
lpr -Plp makefile
source
Linux: how to list printer names acceptable for use with lpr?
$ lpstat -p -d
From the CUPS
manual.
source
Cups line printer skip page after printing one line
The CUPS
printer server considers everything that
you send it as a separate printer job. This means, your line
containing "Hi" is a printer job. By default, different printer
jobs go to different pages; this explains what you are now
getting.
Now, 30 years ago when all printers were like your Epson 9pin,
things were different. Printer managers like CUPS
were seldom used. It was very common to send data to the printer
one line at a time, like you do with your echo
, and
it was natural for the printer to wait for the next line, without
going to the next page. This is how we used to print stuff. If
you want to do that now, you'll have to print using "RAW" mode,
practically bypassing the printer job management that CUPS
performs. You'll also need to suppress the "form feed" that CUPS
by default sends in between printer jobs, which causes the page
change; you'll need to print a final "form feed" yourself.
I suggest that you take a look here, you may find your answer already
waiting.
description
lpr
submits files for printing. Files named on the command line
are sent to the named printer (or the default destination if
no destination is specified). If no files are listed on the
command-line, lpr reads the print file from the
standard input.
options
The following
options are recognized by lpr:
-E
Forces encryption when connecting to the server.
-H server[:port]
Specifies an alternate
server.
-C "name"
-J "name"
-T "name"
Sets the job name.
-P destination[/instance]
Prints files to the named
printer.
-U username
Specifies an alternate
username.
-# copies
Sets the number of copies to
print from 1 to 100.
-h
Disables banner printing. This option is equivalent to
"-o job-sheets=none".
-l
Specifies that the print file is already formatted for
the destination and should be sent without filtering. This
option is equivalent to "-o raw".
-m
Send an email on job completion.
-o option[=value]
Sets a job option.
-p
Specifies that the print file should be formatted with a
shaded header with the date, time, job name, and page
number. This option is equivalent to "-o
prettyprint" and is only useful when printing text
files.
-q
Hold job for printing.
-r
Specifies that the named print files should be deleted
after printing them.
compatibility
The "c", "d", "f", "g", "i", "n", "t", "v", and "w" options are
not supported by CUPS and produce a warning message if used.
copyright
Copyright 2007-2013 by Apple Inc.
the default destination
CUPS provides many ways to set the default destination. The
"LPDEST" and "PRINTER" environment variables are consulted first.
If neither are set, the current default set using the
lpoptions(1) command is used, followed by the default set
using the lpadmin(8) command.
see also
cancel ,
lp , lpadmin , lpoptions ,
lpq , lprm , lpstat ,
http://localhost:631/help