Forrest logo
back to the lp tool

lp:tldr:d54a6

lp: Print a file to a named printer (see `lpstat` command).
$ lp -d ${printer_name} ${filenamename}
try on your machine

The command lp -d ${printer_name} ${filename} is used to print a file using a specific printer.

Here's a breakdown of the command:

  • lp: This is the command used to print files in Unix-like operating systems (like Linux). It sends files to be printed to the printing system.

  • -d ${printer_name}: This option specifies the printer that should be used for printing. ${printer_name} represents the name of the printer. You need to replace ${printer_name} with the actual name of the printer you want to use. For example, if the printer name is "Printer1", the command would be lp -d Printer1.

  • ${filename}: This is the name (with the path if necessary) of the file you want to print. You need to replace ${filename} with the actual name of the file you want to print. For example, if the file is called "document.txt" and is located in the current directory, the command would be lp -d ${printer_name} document.txt.

So, when you run this command with the appropriate printer name and file name, it will send the specified file to the specified printer for printing.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • printing options network printer?
back to the lp tool