8

It is easy to list the printers you've already installed with this command:

lpstat -a

However, this does not list network printers you have NOT installed.

nmap will scan for all open ports on the LAN, but the list produced won't be limited to network printers:

sudo nmap -sT 192.168.0.1-254

Is there a command that does the following:

  1. Detects the LAN you're currently connected to automatically.
  2. Scans the entire LAN looking for Network Printers specifically.
  3. Produces a list of Network Printers providing both their hostnames and IP addresses.

For example, I logged into the web interface of Imagistics fx2100 printer today. It had a "Find device" feature that was capable of finding all the network printers on the LAN (see screenshot below). Seems like there would be a command in Linux that could achieve the same list and info (without scripting):

enter image description here

  • 2
    The problem here is that the criteria ("Network Printer") is something that only makes sense to humans. Computer programs aren't going to have a clear sense of that idea. You might try doing a network sweep for IP addresses that successfully connect on the JetDirect port (tcp/9100). The list is still likely to be incomplete in the case of non-JetDirect printers such as desktop printers shared over SMB. – Bratchley Jun 30 '14 at 18:16
  • 1
    As you mention, a program can scan open ports of each IP on the LAN, and even do a little talking to those ports to gather data. I understand how this could be done. I'm just unaware of any command line utility that already does this (specifically for printers). – Lonniebiz Jun 30 '14 at 18:44
  • 1
    You can do sweeps to find a list of valid IP addresses and use nc to verify that it can connect on tcp/9100. You'd have to script something since this is a very specific problem you're trying to solve. So I doubt anyone's written a tool to do this. – Bratchley Jun 30 '14 at 19:33
3

There isn’t a program that does this specifically, but with nmap -A (advanced host detection/fingerprinting) may be able to identify most printers. You’re going to have to filter it after.

8

If avahi-daemon is running then,

avahi-browse -a | grep Printer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.