how to script duplex printing

p.echols at p.echols at
Thu Apr 19 02:34:07 UTC 2012

----- Original Message -----
> From: "Linda" <haniganwork at>
> To: "Ubuntu user technical support, not for general discussions" <ubuntu-users at>
> Sent: Wednesday, April 18, 2012 5:57:37 PM
> Subject: Re: how to script duplex printing
> On 04/18/2012 04:08 PM, Kevin O'Gorman wrote:
> > I have a little script that makes Postscript from man pages. I
> > sometimes like to print these. I used to use
> >    manlp<something> | lpr
> > and it worked fine. However, I now have a printer capable of
> > duplexing, but to use that feature, I have to
> >    manlp<something> | ps2pdf><somewhere>
> >    evince<somewhere>
> > and tell the printer driver used by evince to duplex its output.
> >
> > Is there some way to script this, preferably in a single pipeline?
> Here is my script for printing pdf files duplex for nautilus
> without opening them. I'm not sure this is what you were
> looking for. I have a separate script to run ps2pdf since I
> don't necessarily want to print most of the files I turn
> into pdfs.
> #!/bin/bash
> #
> # print files from the right-click context menu in Nautilus
> #place this script in ~/.gnome2/nautilus-scripts
> # uses the default print
> read file
> do
> lpr -o sides=two-sided-long-edge "$file"
> done
> exit 0

That should work if that is the correct option string for OP's printer.  (Probably is, but I don't really know enough about it.)

You can find out and set system wide or user defaults by using lpoptions  The man page is somewhat lacking, but there are examples here  Take a look at section 4.  

More information about the ubuntu-users mailing list