Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Thanks!
I looked at the help manual you mentioned, but I didn't see how to redirect or configure the path.
The manual specifies using a printer name, and I would like to use the path.
Can it be done?
so I would like to get lpr to redirect or reroute print jobs to
/dev/usb/lp0 similar to cat filename.ext >/dev/usb/lp0
OR - if anyone cal tell me where to look for options on ">" because when I print a text file, it doesn't print it very nicely, and I am not sure how to print images and other types of files (.bmp, .jpg, .tif, ...)
I need to be able to print text files as they appear and not reformatted.
You might need to explain your reasoning why you want to use redirect to print vs CUPS. Using the redirect basically sends raw characters to the printer and bypasses the printer's drivers. Typically prints accept raw ASCII text characters using their default fonts but it will not use any special formatting. In a nutshell the job of the print driver is to convert your text file for example into a special language that the printer understands so what you see on the screen is what you will see on paper. Now if your file was in the language the printer understands then what you are asking will work. Postscript and PCL are common printer languages. BTW using the print to file printer option will create a postscript file.
You might need to explain your reasoning why you want to use redirect to print vs CUPS. Using the redirect basically sends raw characters to the printer and bypasses the printer's drivers. Typically prints accept raw ASCII text characters using their default fonts but it will not use any special formatting. In a nutshell the job of the print driver is to convert your text file for example into a special language that the printer understands so what you see on the screen is what you will see on paper. Now if your file was in the language the printer understands then what you are asking will work. Postscript and PCL are common printer languages. BTW using the print to file printer option will create a postscript file.
The problem I am seeing is as follows:
When I plug my USB printer, I can find it at /dev/usb/lp0
Then, I try to print to it by typing lpr filename.txt but it never reaches the printer. When I check the lpr queue, I just see it there waiting since it doesn't recognize any printer on my system. So I guess what I should have been asking is how can I configure the lpr to recognize that I have a printer at /dev/usb/lp0
Then, I try to print to it by typing lpr filename.txt but it never reaches the printer. When I check the lpr queue, I just see it there waiting since it doesn't recognize any printer on my system. So I guess what I should have been asking is how can I configure the lpr to recognize that I have a printer at /dev/usb/lp0
Use cups. It has an easy web interface: http://localhost:631
Add Printer .....
...
Print a test page.
If all is well, set it as your default printer.
But why would you want to do that? People keep moaning that linux is "difficult". So there are now easy to use tools to configure pretty much everything if you are a "pointy & clicky" type of person. Why don't you use it (at least as a start) ?
If you want to do it with the command line you need to go back to wfh's post and useful link at #2.
Read it all.
Follow the links. The information is there:
You have to tell cups where your printer is, and what sort of printer it is, & set it as default.
see if you have a /etc/printcap file, I believe it is the file that lpr uses for printer information, I know it does in dsl linux. if you google it there is info out there on how to configure printcap.
Essentially what everyone is saying is this...you need to set up your printer so that it uses Common Unix Printing System (CUPS). Make sure your cupsd is installed and started:
Code:
$ ps ax|grep cups
6647 ? Ss 0:01 /usr/sbin/cupsd
If cups is running, you will be able to see your USB printer when you do this:
System > Administration > Printing > New Printer
...if you are using Ubuntu Gnome. *THEN* you can print from the command line as I posted yesterday:
Code:
lp -d printer filename
Try this and post what you're seeing. We can guide you througn any rough spots.
Thanks everyone. I really appreciate your help and efforts.
Here is what I've done, and I will do things in response to replies.
Quote:
Originally Posted by colorpurple21859
see if you have a /etc/printcap file, I believe it is the file that lpr uses for printer information, I know it does in dsl linux. if you google it there is info out there on how to configure printcap.
I looked into my /etc/printcap file and this is the content:
Code:
# /etc/printcap: printer capability database. See printcap(5).
# You can use the filter entries df, tf, cf, gf etc. for
# your own filters. See /etc/filter.ps, /etc/filter.pcl and
# the printcap(5) manual page for further details.
lp|Generic dot-matrix printer entry:\
:lp=/dev/lp0:\
:sd=/var/spool/lpd/lp:\
:af=/var/log/lp-acct:\
:lf=/var/log/lp-errs:\
:pl#66:\
:pw#80:\
:pc#150:\
:mx#0:\
:sh:
# rlp|Remote printer entry:\
# :lp=:\
# :rm=remotehost:\
# :rp=remoteprinter:\
# :sd=/var/spool/lpd/remote:\
# :mx#0:\
# :sh:
I noticed in the first entry that it is refering to lp0, but it is a dot-matrix printer...
Now, for the second reply, I know I don't have cups installed.
Quote:
Originally Posted by wfh
Essentially what everyone is saying is this...you need to set up your printer so that it uses Common Unix Printing System (CUPS). Make sure your cupsd is installed and started:
Code:
$ ps ax|grep cups
6647 ? Ss 0:01 /usr/sbin/cupsd
If cups is running, you will be able to see your USB printer when you do this:
System > Administration > Printing > New Printer
...if you are using Ubuntu Gnome. *THEN* you can print from the command line as I posted yesterday:
Code:
lp -d printer filename
Try this and post what you're seeing. We can guide you througn any rough spots.
One thing I would like to add is the reason I am trying to do this through command line and not through CUPS is because I am trying to get any printer connected to be used, and the common factor I found between them is the fact that all the USB printers I connected to my system appear under lp0, so I want to keep this part general. Therefore, I don't want my installation to be for a particular printer only, and if I plug a different printer, I prefer not to "add a printer" through cups.
Eventually, what I would like to happen is I will be receiving instructions through a program that will request to print a certain file, and I would like to get a command line based program working with it.
One thing I will try out, however, is to install CUPS and see if that solves my problem... I will write my results as soon as I get them...
One thing I would like to add is the reason I am trying to do this through command line and not through CUPS is because I am trying to get any printer connected to be used ..[SNIP] ..I don't want my installation to be for a particular printer only, and if I plug a different printer, I prefer not to "add a printer" through cups.
I don't think this is going to work.
Just because "any printer" is on lp0 doesn't mean that you can use it.
All printers are different. That's why they generally need "drivers" which tell the OS what the printer's capabilities are, and how it can be used.
If you just plugged any random USB printer into a windows computer, would you expect to be able to print to it without "installing drivers" or "Add New Printer"?
I don't think so. But I haven't configured win in years, maybe it works better now
Then you can set it up with its web interface which can be found at http://localhost:631
But, did you read my post at #12 ? I don't think this is going to do what you want - "I am trying to get any printer connected to be used"
Yes - I realized that my choice of words wasn't the best.
I am aware of the driver requirement, but what I was trying to say is that I didn't have one USB printer that I wanted to work, I wanted to get the general idea of how to get any printer to work.
If you have more thoughts on how Ubuntu handles a newly plugged USB printer, what it does and if the driver is not found, how it handles it?
As for windows, I know that they have general printer drivers that come with the OS, so when you plug a new printer, it goes through a hardware installation process but almost never requests a manually entered driver or online search for a driver...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.