Skip to main content

Network Printer with Generic Driver - Windows and Ubuntu Desktop, print from Bash Shell

348 words·
Network Printer Windows Ubuntu Bash
Table of Contents

Generic Printer Driver for Network Printer
#

Prerequisites
#

I use an old Lexmark T630 printer from my fathers old office for this tutorial. No printers were harmed.

# Printer static IP
192.168.30.20

# Check if printer is reachable via ping
ping 192.168.10.20

Driver Options
#

  • Generic PS (PostScript) Drivers: This produced the very unfocused barely readable output

  • Generic PCL (Printer Command Language) Drivers: Reasonable output

Device Type
#

  • TCP/IP: printer supports standard TCP/IP printing but not necessarily IPP

  • IPP: Printer specifically supports the Internet Printing Protocol (IPP)


Add Network Printer
#

Windows
#

Windows 11
#

  • Open Settings > Bluetooth & devices > Printers & scanners

  • Klick Add Device

  • The printer that I want isn’t listed > Add manually

Windows 10
#

  • Open Settings > Devices > Printers & scanners

  • Click Add a printer or scanner

  • Wait till “Searching for printers and scanners” is done

  • Click The printer that I want isn't listed


Add Printer Wizard
#

  • Define the Printer IP or DNS
  • Select the PS driver
  • Define printer name

Ubuntu
#

  • Open Settings > Printers > Add a Printer...

First Try
#

Ubuntu was able to autodetect the printer:

But the printer did not work at all.

Second Try
#

  • Remove old printer

  • Click Add Printer

  • Manually define the IP of the printer

  • Select JetDirect-Printer

  • Click Add

In the Lexmark section I could only find the the T650 but not the T630 model.

  • Select printer driver: Generic > Generic PCL Laser Printer
  • Open Additional Printer Settings...
  • And rename the printer

Printer Type:

  • JetDirect / AppSocket / Raw Printing: Allows printers to be directly connected to a network, typically using the TCP/IP protocol, often on port 9100

  • LPD (Line Printer Daemon): Older printing protocol used in Unix and Unix-like systems, the printer must be configured to accept LPD requests

Linux Shell Printing
#

Use the following commands to directly print some text from the bash shell:

# Netcat
echo "Hello, this is a test print" | nc 192.168.30.20 9100

# Netcat: Define path to file and close connection after print
nc -q 0 192.168.30.20 9100 < /home/ubuntu/printfile.txt