I am using the ranger terminal based file manager to navigate and view files.
When I navigate to a folder which contains pdf files, and position the cursor on a PDF file ranger reads the file and then displays it in its preview pane .

enter image description here

My understanding is that the ranger program delegates to "rifle" the tasks of

  • recognising what type of file it is - in this case PDF
  • launching a program which handles that filetype
  • instructing the program to load the file currently under the cursor

I now want to open the file being previewed in the text based program that is rendering the preview in the above image. However when I press l to launch ranger/rifle uses "evince", a GUI program.
Looking in

file: ~/.config/ranger/rifle.conf

# Documents
ext pdf, has llpp,     X, flag f = llpp "$@"
ext pdf, has zathura,  X, flag f = zathura -- "$@"
ext pdf, has mupdf,    X, flag f = mupdf -- "$@"
ext pdf, has apvlv,    X, flag f = apvlv -- "$@"
ext pdf, has xpdf,     X, flag f = xpdf -- "$@"
ext pdf, has evince,   X, flag f = evince -- "$@"
ext pdf, has atril,    X, flag f = atril -- "$@"
ext pdf, has okular,   X, flag f = okular -- "$@"
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"

This configuration indicates that evince will be used when a file is "opened" but what program is being used to generate the preview?

  • I am using Ubuntu 16.04

Yes, ranger uses pdftotext to preview PDFs by default, but the answer to your title question is: ~/.config/ranger/scope.sh dictates how files are previewed.

  • 3
    I think this should be the accepted answer. May 17 '19 at 12:03

According to the webpage, it uses pdftotext for pdf previews. (You could read the source code to be certain).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.