The Unix/Linux lpstat command

The Linux lpstat command lets you look at the progress of your print request(s). The name "lpstat" stands for "line printer statistics".

lpstat command examples

The "lpstat" command, used with no options, may return no output if there are no print jobs queued.

The Linux lp printing command

The lp command is used to print files on Unix and Linux systems. The name "lp" stands for "line printer". As with most Unix commands there are a fairly large number of options available to enable flexible printing capabilities.

Let's look at some lp printing commands examples.

Linux lp printing command examples

lp /etc/passwd

This command prints the "/etc/passwd" file to the default printer. If you do not use the "-d" option, the file is printed to the default printer destination.

The Linux cancel command (cancel a print job)

The Linux "cancel" command lets you stop print requests from printing (cancel them).

Linux printing requests can be canceled by either (a) using the printer-id or (b) by specifying the printer name. Here are examples of each approach.

cancel laser-101

This first command cancels the print request identified as "laser-101". (You would have gotten this identifier using an lpstat command.

Perl printing examples

Perl printing FAQ: Can you share some Perl printing examples?

There are several different ways to print in Perl, and I thought I'd share some examples here today.

The Perl print function

Generally you'll print simple output with the Perl print function. As a simple example, you can print a string literal using the Perl print function, like this:

Print files in a Windows directory listing

Here's a tip courtesy of Computer Shopper: Every once in a while I've found a need to print a directory listing on my Windows computer. It only happens once or twice a year, but there are definitely times when I go "Man, I wish I could print the contents of my C:\Projects directory", or something similar. I don't know why MS hasn't built this into Windows.

Sat, Dec 14, 2002

I recently ran into a problem where I had about 50 individual HTML documents, with each document was about 2 pages long,  that I wanted to merge into one big HTML document. After merging all of these into one big document, I wanted them to print with their pages numbered 1-100.