1821981 Members
4137 Online
109638 Solutions
New Discussion юеВ

Re: lpr command

 
SOLVED
Go to solution
Alan Casey
Trusted Contributor

lpr command

I am running HP-UX 11.0 and there is no man entry for the lpr command.

I want to print a text file to a printer using the command line, is this possable?


Alan
9 REPLIES 9
Kellogg Unix Team
Trusted Contributor
Solution

Re: lpr command

Hi Alan,

Use 'lp' command.

lp will print your file to system default printer.

...Manjeet
work is fun ! (my manager is standing behind me!!)
William Whiteford
Occasional Advisor

Re: lpr command

Hi,

you could use
lp -d

assuming the printer has been set up

HTH Billy
Rita C Workman
Honored Contributor

Re: lpr command

Alan,

lpr (or rlp) is used for printing to remote printers. It invokes the rlpdaemon. How was printer set up...??

So, might I ask what device are you printing to??? I think that info might be helpful..

Rita
Alan Casey
Trusted Contributor

Re: lpr command

thanks guys,

I'm having problems with the interpretation of Carriage Return with this command, it is skewing accross the page, any ideas?
Alan Casey
Trusted Contributor

Re: lpr command

hi

got it to work with ux2dos command

Thanks for the help
Alan
James R. Ferguson
Acclaimed Contributor

Re: lpr command

Hi Alan:

If the file came from a Windows environment, a line is delimited with a linefeed/carriage-return instead of a linefeed. The appearance of this usually means you FTP'd a "text" file from Windows to Unix in binary instead of ASCII mode. To strip the carriage-returns and print the file do:

# dos2ux myfile|lp

Regards!

...JRF...
John Palmer
Honored Contributor

Re: lpr command

Hi Alan,

UNIX only uses lf as a line delimiter, Windows uses crlf.

There are some options...

It's usually possible to configure the printer to interpret lf as crlf.

If you've got the printer connected via a Jetdirect card, the lp subsystem uses a program called 'hpnpf' to send the file to the printer. Have a look at 'man hpnpf' and check out the -n and -N flags, one of these should fix your problem. Implement it by amending the relevant interface script (/etc/lp/interface/) and look for HPNPFOPT.

Regards,
John
Pete Randall
Outstanding Contributor

Re: lpr command

Alan,

I suspect you were thinking of the pr command which is sometimes used to format files before piping them to lp.

Pete

Pete
Ernesto Cappello
Trusted Contributor

Re: lpr command

Hi
For a printer named printer#, you must use the following command to print filename

lp -dprinter# filename

For a printer named printer#, configured with an interface script that defines the -c option to cause the printer to print in a compressed mode, use the following command to print filename with compressed print on printer#:

lp -dprinter# -oc filename

Regards.
Ernesto.