Recently, I wanted to print from the command line of a new computer to a printer on the LAN. Recently, most of my new machines have been Macs or iOS devices, where setting up a new printer is trivial. This time though the box ran Debian, and last time I tried to configure a printer on Linux it was a lot of hassle. Happily things have improved!

More specifically, these notes refer to talking to a HP M477 LaserJet Pro from a box running Debian Buster. The printer supports modern APIs including IPP1/AirPrint2 and I think these are key to making the process almost trivial.

There is a lot of information about printing in more general contexts on the Debian Printing Portal3, and specific notes for IPP4.


On macOS printing services are run by CUPS5. This is also available on Debian, so let’s start by installing it:

$ sudo apt-get install cups cups-ipp-utils

Amazingly, that’s basically it. With the wonders of autodiscovery, you don’t even need to edit any files to tell CUPS about the printer. As proof ask lpstat:

$ sudo lpstat -v
device for HP_Color_LaserJet_MFP_M477fdw...
device for HP_Color_LaserJet_MFP_M477fdw...

There are two entries here because one relates to the printer and the other to the printer’s intergrated fax machine.

Rather than stop here, a little polishing is worthwhile. Firstly, It might be helpful to add any admin users to the lpadmin group:

$ sudo usermod -a -G lpadmin [user]

Finally, it’s helpful to make the printer the default:

$ lpoptions -d 'HP_Color_LaserJet_MFP_M477fdw...'

and test it:

 $ echo "Hello World" | lp


The ippfind command is helpful for diagnosing problems: it lists any printers advertising themselves on the LAN:

$ ippfind