Linux provides a mature and flexible printing system using CUPS (Common Unix Printing System) and Ghostscript for interpreting PostScript. With these tools, users can format documents, dispatch them to printers, and manage job queues—all directly from the command line.
In pre-PC environments, printers were shared over terminals. Banner pages and job tagging helped identify user prints. Output delivery was manual.
Impact printers used fixed-width fonts. Control characters like backspace (`^H`) and underscore enabled effects such as bold and underline:
zcat /usr/share/man/man1/ls.1.gz | nroff -man | cat -A | head
Laser printers support graphical output via page description languages like PostScript. Raster image processing (RIP) is now offloaded to the host system using Ghostscript, making printers cheaper and more portable.
CUPS handles printer drivers, spooling, and queue management. Ghostscript interprets PostScript for graphical printers. Together, they support a wide range of media types and output styles.
Formats plain text with headers, margins, and spacing.
pr -3 -w 65 distros.txt
Option | Description |
---|---|
-l | Page length |
-w | Page width |
-h | Custom header title |
-n | Line numbering |
lpr -P myprinter file.txt
-#
for copies-P
for target printer-r
removes source file after printinglp -d myprinter -o page-left=36 -o cpi=12 file.txt
Option | Usage |
---|---|
-o cpi | Characters per inch |
-o lpi | Lines per inch |
-o page-left | Left margin |
-o landscape | Orientation |
Formats files into two-up layouts with headers and footers for PostScript printers.
a2ps file.txt -o output.ps -L 66
lpstat -s
lpstat -a
lpq
Lists active jobs and their status, owner, size, and rank.
cancel 603
Removes job #603. Use lprm
or cancel
depending on system style.
Linux offers full-featured printing utilities rooted in Unix traditions. From formatting pages with pr
and dispatching with lp
, to managing queues via lpq
and lpstat
, command-line users enjoy precise, scriptable control over print workflows—ideal for automation and system-level integration.