lp Command in Linux: Print Files with CUPS

Geometric printer sending a queued document to paper

The lp command submits a file to a CUPS print queue from your terminal. Start by checking the configured destination, then send a small file before adding copies, paper settings, or duplex options.

Check that CUPS can see a printer

lp is a CUPS client command, not a separate printer manager. On Debian and Ubuntu, install the client package with apt install cups-client if lp or lpstat is unavailable. Use the CUPS command-line printing documentation for the current option reference.

lpstat -p -d

The command lists configured printers and reports the default destination, while a command-not-found response means the client is absent and a destination error means CUPS has no matching printer name or cannot reach the server.

Submit a file with lp

Run lp with a file path to use the default printer. CUPS accepts text, PDF, PostScript, and many image formats directly.

lp report.pdf

lp prints a request ID after it accepts the job, which you can use to inspect or cancel that queue entry later.

Choose a printer explicitly

Use -d when more than one destination is configured or when a script must avoid the user’s default printer. Copy the destination name from lpstat rather than guessing its spelling.

lp -d office-printer report.pdf

The destination comes before the file because -d changes where the following job goes.

Set copies, orientation, paper, and duplex printing

The -n flag sets the copy count, while -o passes a named CUPS option for page layout or media selection.

lp -d office-printer -n 2 -o landscape -o media=A4 report.pdf

Use media=A4, media=Letter, or another size advertised by your printer. Inspect its available options before using a setting in a script because unsupported choices can be rejected.

lp -d office-printer -o sides=two-sided-long-edge report.pdf

two-sided-long-edge keeps portrait pages in book order. Use two-sided-short-edge for layouts that turn on the short edge, such as many landscape documents.

Print several files and label the job

Pass multiple paths to submit them in one request, and use -t to supply a title that identifies the job in lpstat output.

lp -d office-printer -t "weekly reports" monday.pdf tuesday.pdf

Quote a title that contains spaces because a missing separator joins paths into a name that does not exist.

Inspect and cancel a queued job

lpstat -o lists queued jobs, including their request IDs. Confirm the matching document before using cancel with a request ID.

lpstat -o
cancel office-printer-42

The lpstat manual documents queue and printer-status flags, and cancellation cannot restore paper already printed.

Prepare files and learn the shell around lp

Printing starts with a file your account can read, so use find to locate a document and check Linux file permissions when lp reports a read error.

Before printing a copied file, preserve file permissions and ownership while copying, compare apt and apt-get for package installation, and use the Linux command line primer when shell paths and options are unfamiliar.

FAQ

These answers cover common lp submission checks.

What does lp do in Linux?

lp submits one or more files to a CUPS print queue. Without -d, it uses the configured default destination.

How do I find my printer name for lp?

Run lpstat -p -d. Its output lists configured printers and identifies the default destination.

How do I print two-sided pages with lp?

Pass -o sides=two-sided-long-edge for book-style duplex printing, or use two-sided-short-edge when your document turns on the short edge.

Run lpstat -p -d before submitting a file to confirm that CUPS has a destination lp can use.