Posted over 6 years ago. Visible to the public. Linked content.

Linux: How to print PDF files from the command line

Sometimes you may want to print files from the command line, especially when you have lots of them.
You can use lp for that.

To print a single example.pdf file on your default printer, simply say:

lp example.pdf

lp accepts multiple filenames, so to print all PDF files in the current directory:

lp *.pdf

You can specify a printer via the -d switch:


Your printer's name is then one you defined on your system. You can check with your CUPS configuration by visiting http://localhost:631/printers. So, for example:

lp -d Brother-MFC-9840CDW *.pdf

Plain-text or PostScript files are also supported.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Arne Hartherz
Last edit:
almost 3 years ago
by Arne Hartherz
ubuntu, line, printer
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more