On Wednesday 04 April 2012 21:14, in alt.os.linux,
chris_r...@internode.on.net wrote:
> Hi
> Wanting to redirect program output from a CLI command to the printer I
> tried:
>
> ls > /dev/lp0
>
> As that seems the logical thing to do, hopeing that the system will take
> care of translating text to whatever is needed to be sent to the printer
> for the expected text to be printed.
It's not as simple as that. For simple ASCII text printers (like old
dot-matrix or teletype-like printers), that's the easiest way to get
printed output, but for more modern printers (inkjet, laser, anything that
takes a formatting language), you /might/ get proper output, but more than
likely, you'll just get hash trying to print that way.
However,
ls | lpr
will work on any system that has system control over it's printers. That's
pretty much all properly installed Linux distributions, these days.
>
> All I get is :
>
> bash: /dev/lp0: Permission denied
>
> Why did this not work?
"Permission denied" implies a permissions problem.
Does your userid or groupid have write access to /dev/lp0?
That is to say,
- are you running as root?
- Or, is your userid the owner of /dev/lp0, and is /dev/lp0 writable by
owner?
- Or do you belong to the group who's groupid is the group owner
of /dev/lp0, and is /dev/lp0 writable by group?
- Or, is /dev/lp0 writable by other?
If none of these conditions are true, then you aren't allowed to write to
the device. Sorry.
> Is there a simple way to redirect?
You've tried the simple way.
> what is the required target for the redirection?
Same answer.
> Thanks for any constructive comments.
> Regards, Chris Roy-Smith
--
Lew Pitcher