📚 College Credit Guide ✓ UPI Study 🕐 8 min read

How Do You Print Files in Linux with lp?

This article shows how lp works in Linux, how it connects to the desktop print dialog, and when a student should use each method.

US
UPI Study Team Member
📅 August 23, 2026
📖 8 min read
US
About the Author
The UPI Study team works directly with students on credit transfer, degree planning, and course selection. We've helped thousands of students figure out what counts toward their degree and how to finish faster without paying more than they have to. This post is written the way we'd explain it to you directly.
🦉

You print files in Linux with lp by sending a job to the print system from the terminal, usually with a command like lp myfile.pdf. That same print system also sits behind the print button in most desktop apps, so the path looks different but the job ends up in the same queue. For a student in an introduction to Linux course, that matters because lp teaches the basic shape of command-line work: name the file, name the printer, check the job, then cancel it if needed. A graphic print dialog hides that process. The terminal shows it. This is most relevant when you use Linux in class, on a remote lab machine, or over SSH. A desktop app can print a Word doc or PDF with a few clicks, but lp helps when you have only a shell prompt and a file path. You can also set copies, choose a destination, and send the same command again without hunting through menus. The main idea is simple. Printing in Linux has 2 faces: the easy click path and the command path. lp belongs to the second one, and it gives you direct control without making the process weird or hard.

A classic MS-DOS terminal screen displayed on a laptop keyboard with vivid illumination — UPI Study

How Does lp Fit Into Linux Printing?

lp sits between your file and the printer queue, and the desktop Print dialog often feeds the same backend, usually CUPS, on Linux systems from Ubuntu 24.04 to Fedora 40. That means the button in LibreOffice and the command in Terminal usually hand work to the same print service, even though one looks friendly and the other looks blunt.

The catch: The print dialog hides the queue name, job ID, and command flags, while lp shows all 3 in plain sight. That can feel rough at first, but a student in an introduction to Linux course learns faster when the machine stops hand-holding and starts showing real commands.

lp exists because terminal work solves simple jobs in seconds, especially on shared lab systems, remote shells, and server boxes where no desktop runs at all. You can type 1 line, send 1 PDF, and move on. That beats clicking through 4 menus when you already know the destination printer.

I like lp for practice because it makes printing feel like any other Linux task: direct, readable, and easy to repeat. A graphically printed page can hide a mistake until paper lands in the tray, but lp lets you see the exact command before you hit Enter. The downside is obvious too. If you hate terminals, lp will feel less cozy than the 2-click route inside a desktop app.

How Do You Print a File with lp?

Start with the printer name, the file path, and a basic lp command. A clean first try looks like lp report.pdf or lp -d HP_LaserJet report.pdf, and the job usually appears in less than 10 seconds on a normal CUPS setup.

  1. Open a terminal and check the printer name with lpstat -p or lpstat -a. That tells you the queue label before you send anything.
  2. Run lp with the file path, such as lp /home/student/Documents/report.pdf. If the file sits in your current folder, lp report.pdf works just fine.
  3. Use -d to pick a destination printer when you have more than 1 queue, like lp -d Office_Printer report.pdf. That matters on shared machines with 2 or 3 printers.
  4. Watch the response for a job ID, such as request id is Office_Printer-12. That number helps you track the job in under 30 seconds.
  5. If you spot the wrong file or wrong printer, cancel fast with cancel 12 or cancel Office_Printer-12. A quick cancel saves paper, toner, and a headache.

Reality check: lp does not need a fancy setup for basic printing, but it does need the file to exist and the printer queue to be reachable. A typo in a 1-word filename can stop the whole job cold.

Introduction To Linux UPI Study Course

Learn Introduction To Linux Online for College Credit

This is one topic inside the full Introduction To Linux course on UPI Study — a self-paced, online class that earns real college credit. Credits are ACE and NCCRS evaluated and transfer to partner colleges across the US and Canada. Courses start at $250 with no deadlines and lifetime access.

See Introduction To Linux →

Which lp Options Matter Most?

You only need a small handful of lp options to handle most student printing jobs. In practice, 4 choices cover the everyday stuff: printer, copies, job name, and page layout.

Bottom line: Most beginners need only -d and -n on day 1, then maybe -t once they start sending 5 or more jobs a week. The rest can wait until a printer menu or class assignment forces the issue.

Why Use lp Instead of a Desktop Print Dialog?

lp wins when you want repeatable control, and the desktop Print dialog wins when you want speed inside a single app. That split shows up fast in real life: a script can call lp 20 times on a lab machine, while a student editing a PDF in Okular can just press Ctrl+P and pick the tray in 15 seconds.

Remote work makes the command line shine. If you connect by SSH to a Linux server at 11:40 p.m., you probably do not have a desktop session at all, but you still can print a file with lp if the server shares the right queue. That also helps in batch jobs, class labs, and simple automation, where the same command can print the same report every Friday.

The desktop dialog still has a real place. It feels easier for a one-time photo print, a form, or a 2-page PDF when you already have the app open. I would not force lp on someone who only prints twice a month from a GUI. That would be busywork, not skill-building.

What this means: lp matters most when you want control, speed, and a clean command you can repeat later. The dialog matters most when you want fewer decisions and a visual preview before the paper moves.

What Should You Check When Printing Fails?

Printing fails for a few boring reasons, and most of them show up in the first 60 seconds: the printer sits offline, the queue name is wrong, the file path does not exist, or the print service is stopped. On Ubuntu and other CUPS-based systems, one bad queue name can block a job even when the printer itself works fine. That is why a quick check list saves more time than random retries.

If the queue looks stuck, cancel the job and resend it once. That simple move fixes more broken prints than people want to admit. A job ID like printer-14 gives you a clean target, and the printer name tells you where the file went. The downside is plain: Linux printing feels easy only after you learn 3 or 4 names and stop treating every printer like the same machine.

Frequently Asked Questions about Linux Printing

Final Thoughts on Linux Printing

lp looks small, but it teaches a real Linux habit: name the file, name the printer, check the result, then fix the mistake without drama. That habit helps in class, at work, and on any machine where the terminal matters more than the app icon. The graphical Print dialog still matters. It gives you a fast preview, tray choices, and a simple path for one-off jobs. lp matters when you want repeatable control, remote access, or a clean command you can paste again later. Those two tools do not fight each other. They cover different moments. A student who learns both gets a better feel for Linux than someone who only clicks through menus. This is important in an introduction to Linux course, but it also spills into real work, because printers fail, queues jam, and file paths break at the worst time. Keep the first command simple. Check the printer name, print one file, read the job ID, and cancel it once just to see how it works. Then try the desktop dialog on the same file and notice how the same print system sits behind both paths. After that, printing stops feeling mysterious, and that is the part that really sticks.

How UPI Study credits actually work

Ready to Earn College Credit?

ACE & NCCRS approved · Self-paced · Transfer to colleges · $250/course or $99/month

More on Introduction To Linux
© UPI Study. This article and its educational content are solely owned by UPI Study and licensed under CC BY-NC-ND 4.0. It is not free to reuse or modify. Any citation must credit UPI Study with a direct link to this page.