1752778 Members
6116 Online
108789 Solutions
New Discussion юеВ

Re: Printing with Linux

 
John R Sherman
Occasional Advisor

Printing with Linux

Can anyone give me info on print commands under Linux (Red Hat)? I'm trying to print bar codes and the PCL commands are printing instead of bar codes (HP1320 printer). Are there any Linux commands that will send files to the printer?
Thanks,
John Sherman
4 REPLIES 4
Matti_Kurkela
Honored Contributor

Re: Printing with Linux

Which version of RedHat? And RedHat may have several printing engines available in each distribution: are you using CUPS, LPRng or something else?

How is the printer connected? If it uses a parallel or USB connection, you can use basic commands like "cat" to bypass the print spooler and send files directly to the printer:

cat filename > /dev/lp0
cat filename > /dev/usb/lp0

If you're using a JetDirect connection, you might use the "rlpr" command or dump the data to printer's network port (TCP/9100) using netcat (nc) or even "telnet printername 9100 < filename".

Bypassing the print spooler on a parallel- or USB-connected printer usually requires more permissions than the normal user has. It's also not recommended when multiple users may be trying to print simultaneously.

Regardless of which print spooling engine you're using, the normal printing command is generally either "lp" or "lpr". CUPS uses "lp" natively, but it can provide the "lpr" command too if you have something that requires BSD-style printing commands.

Both styles of commands can have various options to bypass automatic format detection and send the file to the printer explicitly as-is. Usually the options are "lp -o raw" or "lpr -l".

MK
MK
John R Sherman
Occasional Advisor

Re: Printing with Linux

Hi Matti,
Version of Linux... I'm really not a Linux expert. What command will give me that (we're not using the GUI). I just tried using lp to print the raw file, but it didn't work (the bar code didn't print).
Matti_Kurkela
Honored Contributor

Re: Printing with Linux

If it's a RedHat Linux, then "cat /etc/redhat-release" should display the version. If this works, it's either RedHat Linux 9 or older (=way out of support) or one of the RedHat Enterprise Linux distributions.

If it's one of the RedHat's free Fedora distributions, then examine /etc/fedora-release.

If the lp command caused at least *something* to print, the output of "lpstat -v" might tell us more about how your printer is connected. "lpstat -l -p" and "lpoptions" output listings might also help.

MK
MK
skt_skt
Honored Contributor

Re: Printing with Linux

"printconf-tui"

# whereis printconf-tui
printconf-tui: /usr/sbin/printconf-tui