- How to Become a Chief Information Officer: CIO Cheat Sheet
- 3 handy upgrades in MacOS 15.1 - especially if AI isn't your thing (like me)
- Your Android device is vulnerable to attack and Google's fix is imminent
- Microsoft's Copilot AI is coming to your Office apps - whether you like it or not
- How to track US election results on your iPhone, iPad or Apple Watch
How to print from the Linux command line: double-sided, landscape and more
$ lpoptions | tr " " 'n' | more copies=1 device-uri=socket://192.168.0.15 finishings=3 job-cancel-after=10800 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=1717856401 marker-colors=#000000,#00FFFF,#FF00FF,#FFFF00 marker-levels=5,28,68,27 marker-names="Black Cartridge HP CC530A,Cyan Cartridge HP CC531A,Magenta Cartridge HP CC533A,Yellow Cartridge HP CC532A" marker-types=toner,toner,toner,toner number-up=1 print-color-mode=color printer-commands=AutoConfigure,Clean,PrintSelfTestPage printer-info='HP
If you have multiple printers available, you can use the -p option to specify a particular printer.
$ lpoptions -p LaserJet
With the -v option, the lpinfo command will list drivers and related information, including the printer’s IP address.
$ lpinfo -v file cups-brf:/ network beh direct hp network ipps network lpd network socket network http network ipp network https network smb direct hpfax network socket://192.168.0.15 network dnssd://HP%20Color%20LaserJet%20CP2025dn%20(F47468)._pdl-datastream._tcp.local/
Now that we’ve taken a look at all the details you can view about your printers, let’s dive into printing.
Using the lp command
To print a document on the default printer, just use the lp command followed by the name of the file that you want to print. If the filename includes blanks (rare on Linux systems), either put the name in quotes or start entering the file name and press the tab key to invoke file completion (as shown in the second example below).
$ lp mystory $ lp the whole story request id is HP-Color-LaserJet-CP2025dn-2 (1 file(s))
Use the lpq command to view the files in the printer queue. Note, however, that some files will print so quickly that they’ll be done before you hit the enter key after typing “lpq” and you won’t get a listing. In this case, I put the lpq command on the same line to avoid the print finishing too quickly.
$ lp the whole story ; lpq request id is HP-Color-LaserJet-CP2025dn-3 (1 file(s)) HP-Color-LaserJet-CP2025dn is ready and printing Rank Owner Job File(s) Total Size active shs 3 the whole story 1024 bytes
Printing multiple copies of a file
With the -n option, the lp command allows you to specify the number of copies of a printout you want.