LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-04-2007, 09:15 PM   #1
SPo2
Member
 
Registered: Jun 2005
Posts: 88

Rep: Reputation: 15
Printing to Printer port


Hi

Can someone advise me how can i print to a printer port by dumping files directly ?


In Windows, i can do it in cmd "copy file.txt lpt1"
similar, how can i do it in linux?


I use Mandriva 10.1,
2.6 kernel,


pls advise....it will be good if you can inform me on dumping via USB/LAN/COM1 parameters.
thanks so much...!
 
Old 01-05-2007, 02:23 AM   #2
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
I don't think a regular user can write directly to a hardware port. Someone correct me if I'm wrong. But you can use the lpr command to achieve the same result:

lpr file.txt

will "copy" your file to the default printer.

lpr -P printer_name file.txt

will "copy" your file to the named printer. I'm not sure of the format for the printer name. Try using /dev/lp0. The man page implies that it is the name assigned in cups. If you want raw, unformatted data sent to the printer, use the -l option instead.

This information is available on your system with the man lpr command. Your version of lpr may differ from mine, so you are better off checking your local documentation to verify what I'm telling you.
 
Old 01-05-2007, 02:34 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You may check the printer name by issuing 'lpq' that gives the status of the queues for each known printer.
 
Old 01-05-2007, 04:02 AM   #4
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
I'm no expert here, but since no-one else answers...
<edit>ooops, during this short time some (and better) anwers</edit>
Code:
cat /path/and/file/name > /dev/lp0
is my guess .

Now, what it does is catalogueing (=printing) the file to the device lp0 (you can test it by simply typing
Code:
cat /path/and/file/name
and see the file on the screen.

It needs the device lp0 though and that depends from how you set up the printing system on your box, whether the printer is on the parallel port or USB etc...

If this doesn't work, /dev/ is browsable you can search there for your printer...

Last edited by JZL240I-U; 01-05-2007 at 04:07 AM. Reason: given in the post ;)
 
Old 01-05-2007, 06:33 AM   #5
SPo2
Member
 
Registered: Jun 2005
Posts: 88

Original Poster
Rep: Reputation: 15
HI
thanks all your replies,
:>

LIke in WIndows, using "copy filename.txt lpt1" will
skip driver & spooler to send data to lpt port,


so if i don't want to setup a printer/driver in linux but
i want to send file directly to which ever device lp0's at?


Will try with "cat filename > /dev/lp0" to see if it works...

thanks guys!
 
Old 01-05-2007, 06:53 AM   #6
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Okay. Come back and tell us your solution .
 
Old 01-11-2007, 06:31 AM   #7
SPo2
Member
 
Registered: Jun 2005
Posts: 88

Original Poster
Rep: Reputation: 15
HI;

Thanks...indeed the command is $ cat filename.txt > /dev/lp0

:>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WolfLand Not Printing from Terminal Printer Port AshCokeandDash Linux - Software 1 02-24-2006 11:21 AM
Printing to a remote printer and a local port bamajr Linux - Software 1 02-22-2006 06:43 PM
Printing to a remote printer and a local port bamajr Linux - General 2 02-22-2006 12:51 PM
Printing to a remote printer and a local port bamajr Programming 0 02-22-2006 08:23 AM
Printing thru Com Port Printer Debby Linux - General 0 06-11-2002 09:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration