ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Unix Command line - Printer Details

    IT Discussion
    osx unix terminal lpstat lpinfo lpadmin apple lpoptions
    3
    12
    1.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by DustinB3403

      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.

      1 Reply Last reply Reply Quote 1
      • black3dynamiteB
        black3dynamite
        last edited by

        @DustinB3403 said in Unix Command line - Printer Details:

        lpstat

        lpoptions -p PrinterName | grep 'printer-make-and-model='
        
        DustinB3403D 1 Reply Last reply Reply Quote 1
        • DustinB3403D
          DustinB3403
          last edited by DustinB3403

          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"

          1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403
            last edited by

            Specifically, I'd want to try to find the highlighted information here even though this is just a sample printer.

            CkHTZ5rh5O.png

            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller
              last edited by

              If you do an lpstat -t, does the info every appear in the output?

              DustinB3403D 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @scottalanmiller
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • DustinB3403D
                  DustinB3403
                  last edited by DustinB3403

                  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. .

                  1 Reply Last reply Reply Quote 0
                  • black3dynamiteB
                    black3dynamite
                    last edited by

                    @DustinB3403 said in Unix Command line - Printer Details:

                    lpstat

                    lpoptions -p PrinterName | grep 'printer-make-and-model='
                    
                    DustinB3403D 1 Reply Last reply Reply Quote 1
                    • DustinB3403D
                      DustinB3403 @black3dynamite
                      last edited by

                      @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.

                      black3dynamiteB 1 Reply Last reply Reply Quote 0
                      • black3dynamiteB
                        black3dynamite @DustinB3403
                        last edited by

                        @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.

                        1 Reply Last reply Reply Quote 0
                        • DustinB3403D
                          DustinB3403
                          last edited by DustinB3403

                          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!

                          black3dynamiteB 1 Reply Last reply Reply Quote 0
                          • black3dynamiteB
                            black3dynamite @DustinB3403
                            last edited by

                            @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.

                            DustinB3403D 1 Reply Last reply Reply Quote 1
                            • DustinB3403D
                              DustinB3403 @black3dynamite
                              last edited by

                              @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.

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post