APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Printing FAQ

How do I set up a network printer or print server?

Updated September 2009

LPR/LPD printers

Of course Unix/Linux systems know how to print to these. SCO called them "Remote" printers, but LPD (RFC1179) is what they meant (though uncheck the "extended protocol" unless the printer is on another SCO box).

In the absence of a printer config tool, you can easily add lpd printers to /etc/printcap - there's lots of information here about that.

Even Windows can print to LPD, but you have to install "Other Network File and Print Services" from "Add/Remove Windows Components". Windows can also be an LPD server; you need "Print Services For Unix" to get that.

Direct socket printers

HP printers, Netgear print servers and others often use direct socket printing. To print, you simply send data to a specific network port: 9100 for HP, 9101 for the second printer on a HP multiport print server, 4010 for Netgear and so on. There's no protocol, headers, trailers - whatever you send, the printer gets.


With CUPS, you can do this right from the command line:

sudo lpadmin -p laserjet6L -E -v socket:// -m laserjet

In that case, we want to call our printer "laserjet6L" and it lives at on port 4010 (that's a Netgear Printserver).

You can do the same thing on OS X if it fails to find your printer by itself.

SCO (System V)

If your printer does LPD, you set it up as a Remote Printer.

If it does not, see the example of using "netcat" at How do I install a HP Network Printer or Print Server?. You'll need to know its IP address and /Jeffl/portnumbers.html.


Windows has a very strange setup for this. You'd logically think that you'd choose "Network Printer", but no, you need to choose "Local" and then create a new port, choosing TCP/IP as the port type. If this is a port 9100 printer (HP), that's "Generic"; otherwise you choose the port in the advanced configuration.


You can send data straight to any port printer:

use IO::Socket;
$host=shift @ARGV;
$port=shift @ARGV;
$socket=IO::Socket::INET->new(PeerAddr=> $host, PeerPort=> $port, Proto=> 'tcp',
Type=> SOCK_STREAM) or die "Can't talk to $host at $port";

while (<>) {
print $socket $_;
close $socket;


On Linux/Unix/OS X, you could also use "nc" for the same purpose. "cat yourfile | netcat printer_ip_address 9100", for example.

For old SCO, see Where do I get "netcat" and how do I use it?

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> How do I set up a network printer or print server?


More Articles by

Find me on Google+

Click here to add your comments
- no registration needed!

Tue Sep 8 20:23:20 2009: 6875   TonyLawrence

I did a bit of updating on this today. I intend to go through all the old FAQ material and update it where appropriate. Please drop a comment if I made a mistake or missed anything.

Wed Jun 23 10:58:51 2010: 8736   antonius


I wonder if one could setup cups to act like a virtual spooler that way to generate ps files into a folder ?

Wed Jun 23 12:16:17 2010: 8737   TonyLawrence


Yes, you can. See (link) and be sure to read the comments too.

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments

If you want a picture to show with your comment, go get a Gravatar
Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Jump to Comments

Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

I am a Kerio reseller. Articles here related to Kerio products reflect my honest opinion, but I do have an obvious interest in selling those products also.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

This post tagged: