lp - Unix, Linux Command


Advertisements


NAME

lp: submits files for printing or alters a pending job..

SYNOPSIS

  • lp -i request-ID [-c] [-m] [-p] [-s] [-w] [-d destination] [-f form-name] [-H special-handling] [-n number] [-o options] [-p pagenumbers] [-q priority-level] [-S character-set | print-wheel] [-t title] [-T content-Type [-r]] [-y mode-list]
  • DESCRIPTION

    lp command arranges for the files specified by the Files parameter and their associated information (called a request) to be printed by a line printer. If you do not specify a value for the Files parameter, the lp command accepts standard input. The file name - (dash) represents standard input and can be specified on the command line in addition to files. The lp command sends the requests in the order specified. If the job is submitted to a local print queue, the lp command displays the following to standard output: Job number is: nnn where nnn is the assigned job number. To suppress the job number use the -s flag.

    Options

    Tag Description
    -- Marks the end of options; use this to print a file whose name begins with a dash (-).
    -E Forces encryption when connecting to the server.
    -U username Specifies the username to use when connecting to the server.
    -C This option is provided for backwards-compatibility only. On systems that support it, this option forces the print file to be copied to the spool directory before printing. In CUPS, print files are always sent to the scheduler via IPP which has the same effect.
    -d destination Prints files to the destination printer.
    -h hostname[:port] Chooses an alternate server.
    -i job-id Specifies an existing job to modify.
    -m Sends an email when the job is completed.
    -n copies Sets the number of copies to print from 1 to 100.
    -o "name=value [name=value ...]" Sets one or more job options.
    -q priority Sets the job priority from 1 (lowest) to 100 (highest). The default priority is 50.
    -s Do not report the resulting job IDs.
    -t "name" Sets the job name.
  • -H hh:mm
  • -H hold
  • -H immediate
  • -H restart
  • -H resume
  • Specifies when the job should be printed. A value of immediate will print the file immediately, a value of hold will hold the job indefinitely, and a UTC time value (HH:MM) will hold the job until the specified UTC (not local) time. Use a value of resume with the -i option to resume a held job. Use a value of restart with the -i option to restart a completed job.
    -P page-list Specifies which pages to print in the document. The list can contain a list of numbers and ranges (#-#) separated by commas (e.g. 1,3-5,16). The page numbers refer to the output pages and not the document's original pages - options like "number-up" can affect the numbering of the pages.

    EXAMPLES

    Example-1:

    To print the /etc/motd file on printer lp0 attached to device dlp0, enter:

    # lp /etc/motd 

    Example-2:

    To print 30 copies of the /etc/motd file using a copy of the file, and to notify the user that the job is completed using mail, enter:

    # lp  -c  -m  -n30  -dlp0:lpd0 /etc/motd 

    Example-3:

    To print the /etc/motd file using backend flags -f and -a, with a job title of blah, enter:

    # lp  -t"blah"  -o -f  -o -a /etc/motd 

    Example-4:

    To queue the MyFile file and return the job number, enter:

    # lp myfile

    Example-5:

    To queue the MyFile file and suppress the job number, enter:

    # lp  -s myfile

    Example-6:

    To Print the double-sided legal document filename to printer myprinter.

    # lp -d myprinter -o media=legal -o sides=two-sided-long-edge filename

    Example-7:

    Print document filename across 4 pages.

    # lp -d myprinter -o scaling=200 filename

    Example-8:

    Print a text file with 12 characters per inch, 8 lines per inch, and a 1 inch left margin.

    # lp -d myprinter -o cpi=12 -o lpi=8 -o page-left=72 filename


    Advertisements