William Blankenship

Share this post

Bye CUPS: Printing with netcat

retrohacker.substack.com

Bye CUPS: Printing with netcat

Turns out printing doesn't have to be hard

William Blankenship
Aug 3, 2021
2
18
Share this post

Bye CUPS: Printing with netcat

retrohacker.substack.com

I recently migrated my daily laptop to FreeBSD. I have a networked HP LaserJet. After 10+ years of CUPS on Linux, I had been dreading setting up this printer on yet another machine. But the day came. I had to print quite a few documents so I decided to bite the bullet and setup printing on FreeBSD.

Off to the FreeBSD Handbook I went. Conveniently, they have a chapter on Printing. Given my past experience with CUPS, I figured this was going to be a treacherous journey so I read the entire document before getting started. Section 4 stood out:

Direct printing to network printers depends on the abilities of the printer, but most accept print jobs on port 9100, and nc(1) can be used with them.

nc netlaser 9100 < sample.txt

I had to read this several times. WTF. Use netcat? Surely I was missing some wizardry in the FreeBSD kernel that configured a network printer as some local network target aliased to netlaser, which handled all the printing magic for me. But how? Years of arbitrarily picking from a list of similarly named print drivers in CUPS prevented my brain from accepting what was written. I was confused. After trying to decipher the other sections in the document, I decided I would go for it.

nc 192.168.1.226 9100 < file.pdf

It. Just. Prints.

After 10+ years of Linux distributions pushing CUPS on me. Over a decade of this complex stack of drivers and daemons that I never quite trusted but “couldn’t live without.” FreeBSD comes along and is like “yeah, just use netcat.” And they’re right. Just use netcat.

Bye CUPS.

18
Share this post

Bye CUPS: Printing with netcat

retrohacker.substack.com
18 Comments
Luc
Aug 3, 2021Liked by William Blankenship

Hah I love this post. The gifs are perfect, it's not overly long with a ton of filling before getting to the point, I love it

Expand full comment
Reply
Nathan Myers
Aug 4, 2021Liked by William Blankenship

Tried it. One page, blank except "Unsupported PDF data for Direct Print:1000". This on a Brother HL-L3210CW, duplex color laser.

Printers have become overwhelmingly simpler to support in recent years (i.e. since, say, 2011), rendering much of what used to be needed in CUPS superfluous. CUPS and all its apparatus was necessary until that happened. Nowadays it suffices to tell CUPS you have a generic printer, and it will find out what it needs to know from the printer. But the old stuff still has to work, for the old printers which people still expect to be able to continue using.

Expand full comment
Reply
1 reply by William Blankenship
16 more comments…
TopNewCommunity

No posts

Ready for more?

© 2023 William Blankenship
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing