1

Some years ago, the lpstat command would report if a printer is offline. This features seems to have disappeared; it doesn't seem to be available in Ventura. Is there a way to determine from the terminal (or a shell script) whether or not a printer is online? The printer list in System Settings can display whether a printer is online, so I hope there might be shell-script way of doing it.

I've searched extensively, and can't find an uptodate answer.

3
  • Did you try lpstat -t?
    – nohillside
    Oct 9, 2023 at 5:35
  • Yes. It does not make any distinction between printers that are online and offline. I have three printers installed that are five hundred miles away and powered down; every lpstat switch that I've tried gives the same result for those printers and for the ones that I can print to now. The older lpstat gave this information; not the current one.
    – emendelson
    Oct 9, 2023 at 12:34
  • It’s entirely possible that Apple changed (broke) something with regards to lpstat. It’s GitHub page shows that it was updated just 7 months ago. I haven’t delved much deeper to see what the exact changes were
    – Allan
    Apr 15 at 2:31

1 Answer 1

0

I am trying to get the printer status in an app I am working on. I couldn't find anything and like you said the lpstat command doesn't work as you would like.

However I was able to ping my printer and if I get packets back I know its online. Maybe this will help you. Find your printers IPV4 address which can be found on the printer. and then ping via terminal

ping -c 1 xxx.xxx.xx.xxx

-c = count so if you want to ping it 1 or many times you can achieve it that way. When I ping my printer and its powered down I dont get any packets back.

7
  • 2
    Just wondering whether a printer can be offline from a „can print“ perspective (e.g. while changing ink) but online from a network perspective. Besides that, good idea with using ping.
    – nohillside
    Oct 17, 2023 at 18:35
  • Terrific suggestion. Will see whether I can make this work in my AppleScript that displays a list of installed printers. Question: is there a terminal command that will give the IP address of an installed printer?
    – emendelson
    Oct 18, 2023 at 18:18
  • @nohillside ping will return packets even if changing ink or paper jam etc. as long is its connected to the network you will get packets back. If you find a way to return an "Error"(ink being changed..) Id love to see it because it would be useful to me.
    – Trey6
    Oct 18, 2023 at 21:02
  • @emendelson not entirely sure. from a couple searches, doesn't look like you can get the ip via terminal, Maybe if you download another tool you can?
    – Trey6
    Oct 18, 2023 at 21:03
  • @Trey6 - Yes, I haven't found anything either...
    – emendelson
    Oct 19, 2023 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .