![Forrest logo](/images/logo.png)
lp:tldr:d22f1
lp: Print the output of a command to the default printer (see `lpstat` command).
$ echo "test" | lp
try on your machine
This command is a simple example of using shell redirection.
The echo
command is used to display a specified string on the terminal. In this case, the string being displayed is "test".
The |
symbol is known as a pipe and it is used for redirecting the output of one command to another command. In this case, it is redirecting the output of the echo
command to the lp
command.
The lp
command is used to print files. By using this command after the pipe, it takes the output of the echo
command ("test") and sends it as input to the lp
command, resulting in "test" being sent to the 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.