Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was just wondering if there is a way to display content of a PDF file inside terminal, just like doing less file.txt but with PDF files.

share|improve this question

migrated from Oct 17 '09 at 22:13

This question came from our site for professional and enthusiast programmers.

There are tools that allow to extract text from PDF files (Google for it) but IMHO there are cases where this will simply be not possible (imagine a PDF that contains only images).

share|improve this answer

The program pdftotext, which comes as a part of xpdf, can convert a PDF to text. There is also a program called lesspipe, which can be set as a preprocessor for less so that if you have pdftotext or something like it installed, you can just use less with PDF (and many other types of files).

share|improve this answer

You can use less to view pdf text in terminal. It works quite well but garbles do happen.

share|improve this answer
At least use strings filename.pdf | less – Kevin Panko Jan 6 '14 at 20:26
That won't work at all if the streams are compressed. – Dennis Jan 6 '14 at 20:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.