Get list of connected printers












0















So, I understand that I can list all printers with



$ lpstat -p -d
printer DYMO-LabelWriter-450-Turbo is idle. enabled since Tue 06 Jun 2017 12:12:48 PM SGT
Waiting for printer to become available.
printer DYMO-LabelWriter-450-Turbo-2 is idle. enabled since Tue 06 Jun 2017 12:12:31 PM SGT
Ready to print.
printer Epson-Stylus-NX420 is idle. enabled since Mon 18 May 2015 05:23:36 AM SGT
printer Photosmart-C4200-series is idle. enabled since Thu 11 May 2017 07:17:13 PM SGT
system default destination: Photosmart-C4200-series


DYMO-LabelWriter-450-Turbo is installed but disconnected and DYMO-LabelWriter-450-Turbo-2 is both installed and connected.



What is the cleanest way to get the list of connected printers? Parsing the output of lpstat for "Ready to print."? Or is there some clean approach using lsusb?










share|improve this question























  • Would a command like lpstat -p -d | grep "Ready to print" work?

    – ThatGuy
    Jun 6 '17 at 4:45











  • @ThatGuy: "Ready to print" is on a newline so that might not work if others want the printer names. But what you're saying is essentially the same idea as my current solution (your idea but in python to grab the printer names more easily). I guess I thought there was some mechanism where lpstat (or some other command) would report connected printers without any grep-ing.

    – rith87
    Jun 6 '17 at 5:57
















0















So, I understand that I can list all printers with



$ lpstat -p -d
printer DYMO-LabelWriter-450-Turbo is idle. enabled since Tue 06 Jun 2017 12:12:48 PM SGT
Waiting for printer to become available.
printer DYMO-LabelWriter-450-Turbo-2 is idle. enabled since Tue 06 Jun 2017 12:12:31 PM SGT
Ready to print.
printer Epson-Stylus-NX420 is idle. enabled since Mon 18 May 2015 05:23:36 AM SGT
printer Photosmart-C4200-series is idle. enabled since Thu 11 May 2017 07:17:13 PM SGT
system default destination: Photosmart-C4200-series


DYMO-LabelWriter-450-Turbo is installed but disconnected and DYMO-LabelWriter-450-Turbo-2 is both installed and connected.



What is the cleanest way to get the list of connected printers? Parsing the output of lpstat for "Ready to print."? Or is there some clean approach using lsusb?










share|improve this question























  • Would a command like lpstat -p -d | grep "Ready to print" work?

    – ThatGuy
    Jun 6 '17 at 4:45











  • @ThatGuy: "Ready to print" is on a newline so that might not work if others want the printer names. But what you're saying is essentially the same idea as my current solution (your idea but in python to grab the printer names more easily). I guess I thought there was some mechanism where lpstat (or some other command) would report connected printers without any grep-ing.

    – rith87
    Jun 6 '17 at 5:57














0












0








0








So, I understand that I can list all printers with



$ lpstat -p -d
printer DYMO-LabelWriter-450-Turbo is idle. enabled since Tue 06 Jun 2017 12:12:48 PM SGT
Waiting for printer to become available.
printer DYMO-LabelWriter-450-Turbo-2 is idle. enabled since Tue 06 Jun 2017 12:12:31 PM SGT
Ready to print.
printer Epson-Stylus-NX420 is idle. enabled since Mon 18 May 2015 05:23:36 AM SGT
printer Photosmart-C4200-series is idle. enabled since Thu 11 May 2017 07:17:13 PM SGT
system default destination: Photosmart-C4200-series


DYMO-LabelWriter-450-Turbo is installed but disconnected and DYMO-LabelWriter-450-Turbo-2 is both installed and connected.



What is the cleanest way to get the list of connected printers? Parsing the output of lpstat for "Ready to print."? Or is there some clean approach using lsusb?










share|improve this question














So, I understand that I can list all printers with



$ lpstat -p -d
printer DYMO-LabelWriter-450-Turbo is idle. enabled since Tue 06 Jun 2017 12:12:48 PM SGT
Waiting for printer to become available.
printer DYMO-LabelWriter-450-Turbo-2 is idle. enabled since Tue 06 Jun 2017 12:12:31 PM SGT
Ready to print.
printer Epson-Stylus-NX420 is idle. enabled since Mon 18 May 2015 05:23:36 AM SGT
printer Photosmart-C4200-series is idle. enabled since Thu 11 May 2017 07:17:13 PM SGT
system default destination: Photosmart-C4200-series


DYMO-LabelWriter-450-Turbo is installed but disconnected and DYMO-LabelWriter-450-Turbo-2 is both installed and connected.



What is the cleanest way to get the list of connected printers? Parsing the output of lpstat for "Ready to print."? Or is there some clean approach using lsusb?







14.04 usb printing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 6 '17 at 4:39









rith87rith87

262




262













  • Would a command like lpstat -p -d | grep "Ready to print" work?

    – ThatGuy
    Jun 6 '17 at 4:45











  • @ThatGuy: "Ready to print" is on a newline so that might not work if others want the printer names. But what you're saying is essentially the same idea as my current solution (your idea but in python to grab the printer names more easily). I guess I thought there was some mechanism where lpstat (or some other command) would report connected printers without any grep-ing.

    – rith87
    Jun 6 '17 at 5:57



















  • Would a command like lpstat -p -d | grep "Ready to print" work?

    – ThatGuy
    Jun 6 '17 at 4:45











  • @ThatGuy: "Ready to print" is on a newline so that might not work if others want the printer names. But what you're saying is essentially the same idea as my current solution (your idea but in python to grab the printer names more easily). I guess I thought there was some mechanism where lpstat (or some other command) would report connected printers without any grep-ing.

    – rith87
    Jun 6 '17 at 5:57

















Would a command like lpstat -p -d | grep "Ready to print" work?

– ThatGuy
Jun 6 '17 at 4:45





Would a command like lpstat -p -d | grep "Ready to print" work?

– ThatGuy
Jun 6 '17 at 4:45













@ThatGuy: "Ready to print" is on a newline so that might not work if others want the printer names. But what you're saying is essentially the same idea as my current solution (your idea but in python to grab the printer names more easily). I guess I thought there was some mechanism where lpstat (or some other command) would report connected printers without any grep-ing.

– rith87
Jun 6 '17 at 5:57





@ThatGuy: "Ready to print" is on a newline so that might not work if others want the printer names. But what you're saying is essentially the same idea as my current solution (your idea but in python to grab the printer names more easily). I guess I thought there was some mechanism where lpstat (or some other command) would report connected printers without any grep-ing.

– rith87
Jun 6 '17 at 5:57










1 Answer
1






active

oldest

votes


















0














lpstat will list printers that are being serviced by cups. I see that you have an HP Photosmart which I believe does not use cups.



Since you will most often be printing from a GUI app such as Libre or Firefox, I've found that clicking on *System Settings > Printers** provides the most useful information.



For cups printers, lpstat -t should give you the maximum amount of current information about all the relevant printers your machine knows about.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f922546%2fget-list-of-connected-printers%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    lpstat will list printers that are being serviced by cups. I see that you have an HP Photosmart which I believe does not use cups.



    Since you will most often be printing from a GUI app such as Libre or Firefox, I've found that clicking on *System Settings > Printers** provides the most useful information.



    For cups printers, lpstat -t should give you the maximum amount of current information about all the relevant printers your machine knows about.






    share|improve this answer






























      0














      lpstat will list printers that are being serviced by cups. I see that you have an HP Photosmart which I believe does not use cups.



      Since you will most often be printing from a GUI app such as Libre or Firefox, I've found that clicking on *System Settings > Printers** provides the most useful information.



      For cups printers, lpstat -t should give you the maximum amount of current information about all the relevant printers your machine knows about.






      share|improve this answer




























        0












        0








        0







        lpstat will list printers that are being serviced by cups. I see that you have an HP Photosmart which I believe does not use cups.



        Since you will most often be printing from a GUI app such as Libre or Firefox, I've found that clicking on *System Settings > Printers** provides the most useful information.



        For cups printers, lpstat -t should give you the maximum amount of current information about all the relevant printers your machine knows about.






        share|improve this answer















        lpstat will list printers that are being serviced by cups. I see that you have an HP Photosmart which I believe does not use cups.



        Since you will most often be printing from a GUI app such as Libre or Firefox, I've found that clicking on *System Settings > Printers** provides the most useful information.



        For cups printers, lpstat -t should give you the maximum amount of current information about all the relevant printers your machine knows about.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 2 at 21:12









        Pablo Bianchi

        2,4451530




        2,4451530










        answered Jun 6 '17 at 4:51









        jones0610jones0610

        1,3281321




        1,3281321






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f922546%2fget-list-of-connected-printers%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Quarter-circle Tiles

            build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

            Mont Emei