Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
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 ;)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.