You can print a web page from a shell prompt using the lp
command. The lp
command is used to print files on a Linux system, and can be used to print web pages as well. Here’s how to do it:
- Open a terminal or shell prompt.
- Use the
curl
command to download the web page you want to print. For example, to download the Google homepage, you would type:curl https://www.google.com
This will download the HTML code for the Google homepage to your terminal.
- Pipe the output of the
curl
command to thelp
command, like this:curl https://www.google.com | lp
This will send the output of the
curl
command to the printer. By default,lp
will print to the default printer on your system. - If you want to print to a specific printer, you can specify the printer name with the
-d
option. For example, to print to a printer named “my_printer”, you would type:curl https://www.google.com | lp -d my_printer
This will send the output to the “my_printer” printer.
Once you have completed these steps, the web page will be sent to the printer and should begin printing. Note that the output may not be formatted correctly for printing, as web pages are designed to be viewed on a screen rather than printed on paper.