Solved Unix Command line - Printer Details
-
On OSX, you have a ton of tools accessible to get all sorts of information, but what I'm struggling to figure out is how can I query for a specific printer name and then list the driver that that printer is using.
I would think
lpstat -l -p <printer-name> | grep <drivername>
would do what I want, but it's not.If I look at the printer details within
Printers and Scanner
the "Kind" shows, which is what I'm specifically looking to determine via the command line.Looking for guidance.
-
@DustinB3403 said in Unix Command line - Printer Details:
lpstat
lpoptions -p PrinterName | grep 'printer-make-and-model='
-
Which the printer "Kind" should and does have the
<drivername>
in it with how I installed the printer. I just want to verify if anyone has a printer of the same name and not that new "Kind" -
Specifically, I'd want to try to find the highlighted information here even though this is just a sample printer.
-
If you do an lpstat -t, does the info every appear in the output?
-
@scottalanmiller said in Unix Command line - Printer Details:
If you do an lpstat -t, does the info every appear in the output?
I get detail, but not the driver name. So no.
-
For anyone reading this in the future, the challenge is we've replaced a printer with a newer model, I can successfully check to see if the new driver is installed and I can list what printers are installed.
What I can't do is verify that the new printer is actually the new printer with the updated driver. (At this point it's just a matter of trusting that I didn't goof up)
So I could hoof it around the office and check workstations and see if the new printer is actually the new printer with the new driver. But I REALLY don't want to do that. .
-
@DustinB3403 said in Unix Command line - Printer Details:
lpstat
lpoptions -p PrinterName | grep 'printer-make-and-model='
-
@black3dynamite said in Unix Command line - Printer Details:
@DustinB3403 said in Unix Command line - Printer Details:
lpstat
lpoptions -p PrinterName | grep 'printer-make-and-model='
That works! now just to filter down just the piece I want to see as I get a wall of text.
-
@DustinB3403 said in Unix Command line - Printer Details:
@black3dynamite said in Unix Command line - Printer Details:
@DustinB3403 said in Unix Command line - Printer Details:
lpstat
lpoptions -p PrinterName | grep 'printer-make-and-model='
That works! now just to filter down just the piece I want to see as I get a wall of text.
Using
awk
should work. -
Here is the completed command.
lpoptions -p <NAME> | grep -o "printer-make-and-model='Your Printer make and Model"
That outputs the exact detail I needed!
-
@DustinB3403 said in Unix Command line - Printer Details:
Here is the completed command.
lpoptions -p <NAME> | grep -o "printer-make-and-model='Your Printer make and Model"
That outputs the exact detail I needed!
lpoptions -p SHCSL_209_ColorPrinter | sed -r "s/^.*(printer-make-and-model.*)'.*$/\1/g; s/'//g; s/printer-make-and-model=//g"
This will remove all the unnecessary text, printer-make-and-model=, and the single quotes.
-
@black3dynamite said in Unix Command line - Printer Details:
@DustinB3403 said in Unix Command line - Printer Details:
Here is the completed command.
lpoptions -p <NAME> | grep -o "printer-make-and-model='Your Printer make and Model"
That outputs the exact detail I needed!
lpoptions -p SHCSL_209_ColorPrinter | sed -r "s/^.*(printer-make-and-model.*)'.*$/\1/g; s/'//g; s/printer-make-and-model=//g"
This will remove all the unnecessary text, printer-make-and-model=, and the single quotes.
Yeah I'm also able to just use
lpoptions -p SHCSL_209_ColorPrinter | grep "'SHCSL_209_ColorPrinter'"
and get what I need in a single line response.