Posted over 5 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:

Copy
lp example.pdf

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

Copy
lp *.pdf

You can specify a printer via the -d switch:

Copy
lp -d YOUR_PRINTER_NAME *.pdf

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:

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

Plain-text or PostScript files are also supported.

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
over 1 year ago
by Arne Hartherz
Keywords:
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 cookies to improve usability and analyze traffic.
Accept or learn more