Ask Your Question

Redirect program output to my usb printer

asked 2012-02-14 16:05:22 +0000

Dieter gravatar image


I'm using Fedora 16 with a Brother DCP-150C printer connected via USB. Ich have absolutely no problems printing any document or text file via LibreOffice or Gedit. But, as soon as I try to redirect program output from any C program to my connected printer as follows

./myprog > /dev/usb/lp0

then nothing happens. Instead I get a 'bash: /dev/usb/lp0: Permission denied' message. Note that /dev/usb/lp0 is the device my printer is connected to.

Can anybody tell me please what I'm doing wrong or what do I should do that program redirection works on my machine.

Thank you in advance for your help.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2012-02-14 20:27:32 +0000

ztank1013 gravatar image

Here you will find interesting command line printing techniques and options:


edit flag offensive delete link more

answered 2012-02-14 19:32:25 +0000

Peter Scott gravatar image

You have to use the lp command to send to the printer device. Using a pipe is easiest.

That is:

$ ./myprog | lp
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.


Asked: 2012-02-14 16:05:22 +0000

Seen: 971 times

Last updated: Feb 14 '12