Convert PDF to Text With less (Linux Tips #1)

I recently discoverred a great trick that I thought was wroth sharing.

If you've ever wanted to peak at a pdf file from the command line or convert a pdf to plain text it turns out you have the capability baked right into you're favorite bash prompt, no additional packages necessary.

The good old less command can read pdfs and does a decent job of spitting out reasonably formatted text.

For example using a pdf copy of the fantastic magazine Linux Voice

less ./Linux-Voice-Issue-031.pdf

Obviously you lose any images, but the ouput from this pdf was 100% readable. If you just need to quickly check the contents of a pdf from the command line or want to search the pdf for some key words this is your answer.

If you want to convert a pdf you have to good old fasioned plain text, then this is a greate place to start (some post processing may be desired to clean it up).

less ./Linux-Voice-Issue-031.pdf > linux-voice-issue-31-for-luddites.txt

Bang! You can now read your linux voice magazine in vim, gedit, notepad, or even emacs (you animal)!

No information format is more future proof than plain old ASCII.