View pdf file in terminal












45















I want to view pdf files directly on our cluster rather than copying them to my local machine and then opening them in a viewer.



How can I view a pdf file in my terminal?










share|improve this question




















  • 1





    See also unix.stackexchange.com/questions/36201/…

    – Marco
    Jun 22 '12 at 12:03






  • 2





    If you're connectiong to the cluster with ssh, I recommend using SSHFS. It provides a common solution to all “How do I do X with remote files” issues.

    – Gilles
    Jun 23 '12 at 0:49











  • Render PDF to framebuffer

    – 炸鱼薯条德里克
    Feb 7 at 15:55


















45















I want to view pdf files directly on our cluster rather than copying them to my local machine and then opening them in a viewer.



How can I view a pdf file in my terminal?










share|improve this question




















  • 1





    See also unix.stackexchange.com/questions/36201/…

    – Marco
    Jun 22 '12 at 12:03






  • 2





    If you're connectiong to the cluster with ssh, I recommend using SSHFS. It provides a common solution to all “How do I do X with remote files” issues.

    – Gilles
    Jun 23 '12 at 0:49











  • Render PDF to framebuffer

    – 炸鱼薯条德里克
    Feb 7 at 15:55
















45












45








45


13






I want to view pdf files directly on our cluster rather than copying them to my local machine and then opening them in a viewer.



How can I view a pdf file in my terminal?










share|improve this question
















I want to view pdf files directly on our cluster rather than copying them to my local machine and then opening them in a viewer.



How can I view a pdf file in my terminal?







terminal pdf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 20 '16 at 17:02









HalosGhost

3,75392236




3,75392236










asked Jun 22 '12 at 10:27









bioinformaticianbioinformatician

373139




373139








  • 1





    See also unix.stackexchange.com/questions/36201/…

    – Marco
    Jun 22 '12 at 12:03






  • 2





    If you're connectiong to the cluster with ssh, I recommend using SSHFS. It provides a common solution to all “How do I do X with remote files” issues.

    – Gilles
    Jun 23 '12 at 0:49











  • Render PDF to framebuffer

    – 炸鱼薯条德里克
    Feb 7 at 15:55
















  • 1





    See also unix.stackexchange.com/questions/36201/…

    – Marco
    Jun 22 '12 at 12:03






  • 2





    If you're connectiong to the cluster with ssh, I recommend using SSHFS. It provides a common solution to all “How do I do X with remote files” issues.

    – Gilles
    Jun 23 '12 at 0:49











  • Render PDF to framebuffer

    – 炸鱼薯条德里克
    Feb 7 at 15:55










1




1





See also unix.stackexchange.com/questions/36201/…

– Marco
Jun 22 '12 at 12:03





See also unix.stackexchange.com/questions/36201/…

– Marco
Jun 22 '12 at 12:03




2




2





If you're connectiong to the cluster with ssh, I recommend using SSHFS. It provides a common solution to all “How do I do X with remote files” issues.

– Gilles
Jun 23 '12 at 0:49





If you're connectiong to the cluster with ssh, I recommend using SSHFS. It provides a common solution to all “How do I do X with remote files” issues.

– Gilles
Jun 23 '12 at 0:49













Render PDF to framebuffer

– 炸鱼薯条德里克
Feb 7 at 15:55







Render PDF to framebuffer

– 炸鱼薯条德里克
Feb 7 at 15:55












7 Answers
7






active

oldest

votes


















48














In many systems less uses lesspipe, which can handle pdftotext automatically. Therefore, you can immediately try



 less file.pdf


which will show the output of pdftotext in less.






share|improve this answer































    25














    I guess, it is not possible to see PDF file in terminal but you can check it's content by converting PDF file to text.
    You can do this as:




    pdftotext a.pdf




    It will produce a.txt file which you can read into VIM.



    For ubuntu-variant, this binary is available in following package.




    poppler-utils







    share|improve this answer



















    • 3





      It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

      – villapx
      Jun 5 '17 at 13:33





















    4














    When I want to "view a pdf file in terminal", that for me means that I want to actually see an uncompressed PDF, I do:



    pdftk in.pdf output out.pdf uncompress


    I always wondered why both less in.pdf and less out.pdf give me just text strings in the PDF (and excluding the text-only PDF commands I'd expect in out.pdf).



    Well, that happens because of the lesspipe assuming I want pdftotext being run first - and since here I don't, I have to specifically disable the lesspipe by setting LESSOPEN environment variable to nothing; that is:



    $ LESSOPEN="" less out.pdf


    And finally, I can view the uncompressed PDF code using less






    share|improve this answer

































      2














      Yet another solution... May I recommend to you the ancient utility mc.



      MC(1)                       GNU Midnight Commander
      mc - Visual shell for Unix-like systems.


      mc is designed around text-based file-management, and it has a “view”
      option (F3 key) which will automatically convert .pdfs to text for viewing
      without a GUI. The code which does this conversion is part of mc itself, so it does not require conversion by other utilities. (Also has a native .html viewer for WIW.)






      share|improve this answer

































        1














        I tried the following with good results:



        pdftotext filname.pdf - | less





        share|improve this answer































          0














          One more solution is to use command gnome-open



          gnome-open youfile.pdf


          Provided that you have login your server with -X option (ssh -X)






          share|improve this answer



















          • 2





            How does this view the PDF file in the terminal?

            – a CVn
            Feb 27 '13 at 12:27











          • Not on terminal, but can view a pdf on issuing command from terminal.

            – bioinformatician
            Feb 28 '13 at 12:40






          • 3





            While that is true, the OP did specifically ask for a terminal-based approach.

            – a CVn
            Feb 28 '13 at 20:52



















          0














          If you run emacs on your machine (emacs comes preinstalled on Ubuntu 18.04), you can virtually open and see a pdf on a remote server by hitting Ctrl-x Ctrl-f (to find-file) and then type in /user@hostname:/path/to/my.pdf and hit Enter (note the very first /). You will then be prompted to enter the server's password and there it is! You can see the pdf inside emacs.



          Navigate through PDF inside emacs



          Use space to go one page down and backspace to go one page up. You can also use arrow keys to scroll through a single page if it doesn't fit in the screen.



          Zoom



          Zoom in by hitting Ctrl-x Ctrl-+. Zoom in more by hitting + only. Or zoom out more by hitting -.



          Context



          Yes, you can connect to a remote server from within emacs using the build-in package tramp that works as simple as I explained above. This method works, not only for pdf, but for any other type of file, such as images.






          share|improve this answer
























            protected by Community Jul 16 '18 at 18:47



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?














            7 Answers
            7






            active

            oldest

            votes








            7 Answers
            7






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            48














            In many systems less uses lesspipe, which can handle pdftotext automatically. Therefore, you can immediately try



             less file.pdf


            which will show the output of pdftotext in less.






            share|improve this answer




























              48














              In many systems less uses lesspipe, which can handle pdftotext automatically. Therefore, you can immediately try



               less file.pdf


              which will show the output of pdftotext in less.






              share|improve this answer


























                48












                48








                48







                In many systems less uses lesspipe, which can handle pdftotext automatically. Therefore, you can immediately try



                 less file.pdf


                which will show the output of pdftotext in less.






                share|improve this answer













                In many systems less uses lesspipe, which can handle pdftotext automatically. Therefore, you can immediately try



                 less file.pdf


                which will show the output of pdftotext in less.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 22 '12 at 10:49









                Jari LaamanenJari Laamanen

                1,7451012




                1,7451012

























                    25














                    I guess, it is not possible to see PDF file in terminal but you can check it's content by converting PDF file to text.
                    You can do this as:




                    pdftotext a.pdf




                    It will produce a.txt file which you can read into VIM.



                    For ubuntu-variant, this binary is available in following package.




                    poppler-utils







                    share|improve this answer



















                    • 3





                      It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

                      – villapx
                      Jun 5 '17 at 13:33


















                    25














                    I guess, it is not possible to see PDF file in terminal but you can check it's content by converting PDF file to text.
                    You can do this as:




                    pdftotext a.pdf




                    It will produce a.txt file which you can read into VIM.



                    For ubuntu-variant, this binary is available in following package.




                    poppler-utils







                    share|improve this answer



















                    • 3





                      It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

                      – villapx
                      Jun 5 '17 at 13:33
















                    25












                    25








                    25







                    I guess, it is not possible to see PDF file in terminal but you can check it's content by converting PDF file to text.
                    You can do this as:




                    pdftotext a.pdf




                    It will produce a.txt file which you can read into VIM.



                    For ubuntu-variant, this binary is available in following package.




                    poppler-utils







                    share|improve this answer













                    I guess, it is not possible to see PDF file in terminal but you can check it's content by converting PDF file to text.
                    You can do this as:




                    pdftotext a.pdf




                    It will produce a.txt file which you can read into VIM.



                    For ubuntu-variant, this binary is available in following package.




                    poppler-utils








                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jun 22 '12 at 10:40









                    SHWSHW

                    8,15553770




                    8,15553770








                    • 3





                      It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

                      – villapx
                      Jun 5 '17 at 13:33
















                    • 3





                      It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

                      – villapx
                      Jun 5 '17 at 13:33










                    3




                    3





                    It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

                    – villapx
                    Jun 5 '17 at 13:33







                    It is possible to see a PDF file in the terminal, like so: pdftotext -layout file.pdf - | less (that's how Ubuntu's default lesspipe script does it)

                    – villapx
                    Jun 5 '17 at 13:33













                    4














                    When I want to "view a pdf file in terminal", that for me means that I want to actually see an uncompressed PDF, I do:



                    pdftk in.pdf output out.pdf uncompress


                    I always wondered why both less in.pdf and less out.pdf give me just text strings in the PDF (and excluding the text-only PDF commands I'd expect in out.pdf).



                    Well, that happens because of the lesspipe assuming I want pdftotext being run first - and since here I don't, I have to specifically disable the lesspipe by setting LESSOPEN environment variable to nothing; that is:



                    $ LESSOPEN="" less out.pdf


                    And finally, I can view the uncompressed PDF code using less






                    share|improve this answer






























                      4














                      When I want to "view a pdf file in terminal", that for me means that I want to actually see an uncompressed PDF, I do:



                      pdftk in.pdf output out.pdf uncompress


                      I always wondered why both less in.pdf and less out.pdf give me just text strings in the PDF (and excluding the text-only PDF commands I'd expect in out.pdf).



                      Well, that happens because of the lesspipe assuming I want pdftotext being run first - and since here I don't, I have to specifically disable the lesspipe by setting LESSOPEN environment variable to nothing; that is:



                      $ LESSOPEN="" less out.pdf


                      And finally, I can view the uncompressed PDF code using less






                      share|improve this answer




























                        4












                        4








                        4







                        When I want to "view a pdf file in terminal", that for me means that I want to actually see an uncompressed PDF, I do:



                        pdftk in.pdf output out.pdf uncompress


                        I always wondered why both less in.pdf and less out.pdf give me just text strings in the PDF (and excluding the text-only PDF commands I'd expect in out.pdf).



                        Well, that happens because of the lesspipe assuming I want pdftotext being run first - and since here I don't, I have to specifically disable the lesspipe by setting LESSOPEN environment variable to nothing; that is:



                        $ LESSOPEN="" less out.pdf


                        And finally, I can view the uncompressed PDF code using less






                        share|improve this answer















                        When I want to "view a pdf file in terminal", that for me means that I want to actually see an uncompressed PDF, I do:



                        pdftk in.pdf output out.pdf uncompress


                        I always wondered why both less in.pdf and less out.pdf give me just text strings in the PDF (and excluding the text-only PDF commands I'd expect in out.pdf).



                        Well, that happens because of the lesspipe assuming I want pdftotext being run first - and since here I don't, I have to specifically disable the lesspipe by setting LESSOPEN environment variable to nothing; that is:



                        $ LESSOPEN="" less out.pdf


                        And finally, I can view the uncompressed PDF code using less







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Aug 3 '14 at 3:37









                        Eric Leschinski

                        1,30211416




                        1,30211416










                        answered Feb 20 '13 at 20:14









                        sdaausdaau

                        2,72463151




                        2,72463151























                            2














                            Yet another solution... May I recommend to you the ancient utility mc.



                            MC(1)                       GNU Midnight Commander
                            mc - Visual shell for Unix-like systems.


                            mc is designed around text-based file-management, and it has a “view”
                            option (F3 key) which will automatically convert .pdfs to text for viewing
                            without a GUI. The code which does this conversion is part of mc itself, so it does not require conversion by other utilities. (Also has a native .html viewer for WIW.)






                            share|improve this answer






























                              2














                              Yet another solution... May I recommend to you the ancient utility mc.



                              MC(1)                       GNU Midnight Commander
                              mc - Visual shell for Unix-like systems.


                              mc is designed around text-based file-management, and it has a “view”
                              option (F3 key) which will automatically convert .pdfs to text for viewing
                              without a GUI. The code which does this conversion is part of mc itself, so it does not require conversion by other utilities. (Also has a native .html viewer for WIW.)






                              share|improve this answer




























                                2












                                2








                                2







                                Yet another solution... May I recommend to you the ancient utility mc.



                                MC(1)                       GNU Midnight Commander
                                mc - Visual shell for Unix-like systems.


                                mc is designed around text-based file-management, and it has a “view”
                                option (F3 key) which will automatically convert .pdfs to text for viewing
                                without a GUI. The code which does this conversion is part of mc itself, so it does not require conversion by other utilities. (Also has a native .html viewer for WIW.)






                                share|improve this answer















                                Yet another solution... May I recommend to you the ancient utility mc.



                                MC(1)                       GNU Midnight Commander
                                mc - Visual shell for Unix-like systems.


                                mc is designed around text-based file-management, and it has a “view”
                                option (F3 key) which will automatically convert .pdfs to text for viewing
                                without a GUI. The code which does this conversion is part of mc itself, so it does not require conversion by other utilities. (Also has a native .html viewer for WIW.)







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Nov 12 '17 at 19:33









                                G-Man

                                13.2k93466




                                13.2k93466










                                answered Nov 12 '17 at 19:10









                                Richard SonnenfeldRichard Sonnenfeld

                                211




                                211























                                    1














                                    I tried the following with good results:



                                    pdftotext filname.pdf - | less





                                    share|improve this answer




























                                      1














                                      I tried the following with good results:



                                      pdftotext filname.pdf - | less





                                      share|improve this answer


























                                        1












                                        1








                                        1







                                        I tried the following with good results:



                                        pdftotext filname.pdf - | less





                                        share|improve this answer













                                        I tried the following with good results:



                                        pdftotext filname.pdf - | less






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Feb 7 at 15:44









                                        jmunschjmunsch

                                        1,7041922




                                        1,7041922























                                            0














                                            One more solution is to use command gnome-open



                                            gnome-open youfile.pdf


                                            Provided that you have login your server with -X option (ssh -X)






                                            share|improve this answer



















                                            • 2





                                              How does this view the PDF file in the terminal?

                                              – a CVn
                                              Feb 27 '13 at 12:27











                                            • Not on terminal, but can view a pdf on issuing command from terminal.

                                              – bioinformatician
                                              Feb 28 '13 at 12:40






                                            • 3





                                              While that is true, the OP did specifically ask for a terminal-based approach.

                                              – a CVn
                                              Feb 28 '13 at 20:52
















                                            0














                                            One more solution is to use command gnome-open



                                            gnome-open youfile.pdf


                                            Provided that you have login your server with -X option (ssh -X)






                                            share|improve this answer



















                                            • 2





                                              How does this view the PDF file in the terminal?

                                              – a CVn
                                              Feb 27 '13 at 12:27











                                            • Not on terminal, but can view a pdf on issuing command from terminal.

                                              – bioinformatician
                                              Feb 28 '13 at 12:40






                                            • 3





                                              While that is true, the OP did specifically ask for a terminal-based approach.

                                              – a CVn
                                              Feb 28 '13 at 20:52














                                            0












                                            0








                                            0







                                            One more solution is to use command gnome-open



                                            gnome-open youfile.pdf


                                            Provided that you have login your server with -X option (ssh -X)






                                            share|improve this answer













                                            One more solution is to use command gnome-open



                                            gnome-open youfile.pdf


                                            Provided that you have login your server with -X option (ssh -X)







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Feb 27 '13 at 9:05









                                            bioinformaticianbioinformatician

                                            373139




                                            373139








                                            • 2





                                              How does this view the PDF file in the terminal?

                                              – a CVn
                                              Feb 27 '13 at 12:27











                                            • Not on terminal, but can view a pdf on issuing command from terminal.

                                              – bioinformatician
                                              Feb 28 '13 at 12:40






                                            • 3





                                              While that is true, the OP did specifically ask for a terminal-based approach.

                                              – a CVn
                                              Feb 28 '13 at 20:52














                                            • 2





                                              How does this view the PDF file in the terminal?

                                              – a CVn
                                              Feb 27 '13 at 12:27











                                            • Not on terminal, but can view a pdf on issuing command from terminal.

                                              – bioinformatician
                                              Feb 28 '13 at 12:40






                                            • 3





                                              While that is true, the OP did specifically ask for a terminal-based approach.

                                              – a CVn
                                              Feb 28 '13 at 20:52








                                            2




                                            2





                                            How does this view the PDF file in the terminal?

                                            – a CVn
                                            Feb 27 '13 at 12:27





                                            How does this view the PDF file in the terminal?

                                            – a CVn
                                            Feb 27 '13 at 12:27













                                            Not on terminal, but can view a pdf on issuing command from terminal.

                                            – bioinformatician
                                            Feb 28 '13 at 12:40





                                            Not on terminal, but can view a pdf on issuing command from terminal.

                                            – bioinformatician
                                            Feb 28 '13 at 12:40




                                            3




                                            3





                                            While that is true, the OP did specifically ask for a terminal-based approach.

                                            – a CVn
                                            Feb 28 '13 at 20:52





                                            While that is true, the OP did specifically ask for a terminal-based approach.

                                            – a CVn
                                            Feb 28 '13 at 20:52











                                            0














                                            If you run emacs on your machine (emacs comes preinstalled on Ubuntu 18.04), you can virtually open and see a pdf on a remote server by hitting Ctrl-x Ctrl-f (to find-file) and then type in /user@hostname:/path/to/my.pdf and hit Enter (note the very first /). You will then be prompted to enter the server's password and there it is! You can see the pdf inside emacs.



                                            Navigate through PDF inside emacs



                                            Use space to go one page down and backspace to go one page up. You can also use arrow keys to scroll through a single page if it doesn't fit in the screen.



                                            Zoom



                                            Zoom in by hitting Ctrl-x Ctrl-+. Zoom in more by hitting + only. Or zoom out more by hitting -.



                                            Context



                                            Yes, you can connect to a remote server from within emacs using the build-in package tramp that works as simple as I explained above. This method works, not only for pdf, but for any other type of file, such as images.






                                            share|improve this answer






























                                              0














                                              If you run emacs on your machine (emacs comes preinstalled on Ubuntu 18.04), you can virtually open and see a pdf on a remote server by hitting Ctrl-x Ctrl-f (to find-file) and then type in /user@hostname:/path/to/my.pdf and hit Enter (note the very first /). You will then be prompted to enter the server's password and there it is! You can see the pdf inside emacs.



                                              Navigate through PDF inside emacs



                                              Use space to go one page down and backspace to go one page up. You can also use arrow keys to scroll through a single page if it doesn't fit in the screen.



                                              Zoom



                                              Zoom in by hitting Ctrl-x Ctrl-+. Zoom in more by hitting + only. Or zoom out more by hitting -.



                                              Context



                                              Yes, you can connect to a remote server from within emacs using the build-in package tramp that works as simple as I explained above. This method works, not only for pdf, but for any other type of file, such as images.






                                              share|improve this answer




























                                                0












                                                0








                                                0







                                                If you run emacs on your machine (emacs comes preinstalled on Ubuntu 18.04), you can virtually open and see a pdf on a remote server by hitting Ctrl-x Ctrl-f (to find-file) and then type in /user@hostname:/path/to/my.pdf and hit Enter (note the very first /). You will then be prompted to enter the server's password and there it is! You can see the pdf inside emacs.



                                                Navigate through PDF inside emacs



                                                Use space to go one page down and backspace to go one page up. You can also use arrow keys to scroll through a single page if it doesn't fit in the screen.



                                                Zoom



                                                Zoom in by hitting Ctrl-x Ctrl-+. Zoom in more by hitting + only. Or zoom out more by hitting -.



                                                Context



                                                Yes, you can connect to a remote server from within emacs using the build-in package tramp that works as simple as I explained above. This method works, not only for pdf, but for any other type of file, such as images.






                                                share|improve this answer















                                                If you run emacs on your machine (emacs comes preinstalled on Ubuntu 18.04), you can virtually open and see a pdf on a remote server by hitting Ctrl-x Ctrl-f (to find-file) and then type in /user@hostname:/path/to/my.pdf and hit Enter (note the very first /). You will then be prompted to enter the server's password and there it is! You can see the pdf inside emacs.



                                                Navigate through PDF inside emacs



                                                Use space to go one page down and backspace to go one page up. You can also use arrow keys to scroll through a single page if it doesn't fit in the screen.



                                                Zoom



                                                Zoom in by hitting Ctrl-x Ctrl-+. Zoom in more by hitting + only. Or zoom out more by hitting -.



                                                Context



                                                Yes, you can connect to a remote server from within emacs using the build-in package tramp that works as simple as I explained above. This method works, not only for pdf, but for any other type of file, such as images.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Jun 24 '18 at 20:58

























                                                answered Jun 23 '18 at 19:21









                                                PooyaPooya

                                                13




                                                13

















                                                    protected by Community Jul 16 '18 at 18:47



                                                    Thank you for your interest in this question.
                                                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                    Would you like to answer one of these unanswered questions instead?



                                                    Popular posts from this blog

                                                    How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                                                    is 'sed' thread safe

                                                    How to make a Squid Proxy server?