Difference between revisions of "Printing CUPS lpr"

From Noah.org
Jump to: navigation, search
(New page: Category:Engineering I don't print from the command-line a lot. This is the minimal I usually need to know to get something printed. == listing installed printers == <pre> lpstat ...)
 
(Install CUPS)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Engineering]]
 
[[Category:Engineering]]
  
I don't print from the command-line a lot. This is the minimal I usually need to know to get something printed.
+
I don't print from the command-line a lot. This is the minimal I usually need to get something printed.
 +
 
 +
== Install CUPS ==
 +
 
 +
On Ubuntu this is pretty easy.
 +
 
 +
<pre>
 +
aptitude install cupsys cupsys-client cupsys-bsd hpijs foomatic-bin
 +
</pre>
 +
 
 +
== Install Network Printer ==
 +
 
 +
You probably don't need to do this. Network printers should be discovered when you install CUPS.
 +
 
 +
<pre>
 +
/usr/sbin/lpadmin -p LaserJet -E -v socket://192.168.1.30 -m laserjet.ppd
 +
</pre>
 +
 
 +
You can also go through the CUPS web interface:
 +
 
 +
<pre>
 +
lynx http://localhost:631/admin
 +
</pre>
  
 
== listing installed printers ==
 
== listing installed printers ==
  
 
<pre>
 
<pre>
  lpstat -p
+
lpstat -p
 
</pre>
 
</pre>
  
Line 12: Line 34:
  
 
<pre>
 
<pre>
 +
printer LaserJet-3055 is idle.  enabled since Tue 20 Nov 2007 12:09:55 PM PST
 
printer NetworkOptra-E321 is idle.  enabled since Tue 12 Jun 2007 03:42:31 PM PDT
 
printer NetworkOptra-E321 is idle.  enabled since Tue 12 Jun 2007 03:42:31 PM PDT
 
</pre>
 
</pre>
Line 31: Line 54:
 
<pre>
 
<pre>
 
lpr -P NetworkOptra-E321 my_document.txt
 
lpr -P NetworkOptra-E321 my_document.txt
 +
</pre>
 +
 +
== hack to print to network printer ==
 +
 +
This is useful for testing. You can simply cat a file to a network printer using telnet to port 9100. For example, this will print the /etc/passwd file to the printer at 192.168.1.30:
 +
 +
<pre>
 +
cat /etc/passwd | telnet 192.168.1.30 9100
 
</pre>
 
</pre>

Latest revision as of 14:30, 2 January 2008


I don't print from the command-line a lot. This is the minimal I usually need to get something printed.

Install CUPS

On Ubuntu this is pretty easy.

aptitude install cupsys cupsys-client cupsys-bsd hpijs foomatic-bin

Install Network Printer

You probably don't need to do this. Network printers should be discovered when you install CUPS.

/usr/sbin/lpadmin -p LaserJet -E -v socket://192.168.1.30 -m laserjet.ppd

You can also go through the CUPS web interface:

lynx http://localhost:631/admin

listing installed printers

lpstat -p

That will show something like the following. The important information is the printer name (NetworOptra-E321).

printer LaserJet-3055 is idle.  enabled since Tue 20 Nov 2007 12:09:55 PM PST
printer NetworkOptra-E321 is idle.  enabled since Tue 12 Jun 2007 03:42:31 PM PDT

printing to a named printer

You can print a document by specifying the printer name on the command-line:

lpr -P NetworkOptra-E321 my_document.txt

Or you can set the default printer with the PRINTER environment variable.

export PRINTER=NetworkOptra-E321
lpr -P NetworkOptra-E321 my_document.txt

hack to print to network printer

This is useful for testing. You can simply cat a file to a network printer using telnet to port 9100. For example, this will print the /etc/passwd file to the printer at 192.168.1.30:

cat /etc/passwd | telnet 192.168.1.30 9100