Linux Notes

Table of Contents

Section 7: Printing Files

It can be simply done by:

$ cat <filename> > /dev/lpt1

But it doesn't support more than one task and user at a time. So? Here are the commands you might want to know:

lp

  • printer input
$ lp [options] <files>

Options:

  • -c send a copy of a file
  • -d<target> select a specific printer
  • -m notify the user via e-mail when it's done
  • -h<x> input the number of copies
  • -r remove the file after the beginning of the process
  • -t<title> print the title on the first page
  • -w same as -m, but notify via a current terminal

pr

  • file format (for printing)
$ pr [options] <file>

Options:

  • -f new page mark input
  • -h printing header
  • -l<n> lines per page
  • -n number of columns
  • -w<n> number of columns

nl

  • line count numbering
$ nl [options] <file>

Options:

  • -b<type> line selection (-ba refers to all lines, -bn refers to none, -bpre refers to lines with a specific phrase only, -bt refers to text-lines only)
  • -i<n> numbering incrementation by n
  • -n<format> numbering format (-nln to the left, -nrn to the right, -nrz to the right with zero on the beginning of the line, etc.)
  • -v<n> first page number

lpstat

  • printing system status
$ lpstat [options] <task_id>

Options:

  • -d shows the printer name and id
  • -s shows a printing summary
  • -t shows all available information

cancel

  • cancels/stops printing
$ cancel <task_id> <printer>