Print a file from the Linux terminal with lp
Send PDFs, text files, and images straight to your printer without opening an app.
Run lp file.pdf to print to the default printer, or lp -d PrinterName file.pdf to pick one.
01Command
Command
$ lp -d HP-LaserJet report.pdf && lp -n 2 -o sides=two-sided-long-edge notes.txt02What it does
lp submits the file to CUPS, the printing system behind most Linux desktops. lpstat -p lists printers and lpstat -d shows the default; -d overrides it for one job. Useful options: -n 3 for three copies, -o sides=two-sided-long-edge for duplex, -o media=A4 for paper size.
03Risk
!Warning: lp sends the job immediately — there is no confirmation dialog. A wrong -d printer means your document may come out of a neighbour's printer; check lpstat -d first.
04Undo
Undo
$ cancel <job-id> (see lpstat -o for job ids)05Sources
- lp(1) — print filesEvidence: lp submits files to CUPS; -d selects the printer, -n sets copies, and -o passes options such as duplex or media size.
Last verified: 2026-09-18 · Category: Files & Folders