accept command in Linux with Examples

In Linux, accept command is used to request the printer to start accepting print requests in the print queue for a named destination that could be a printer or a class of printer. It also enables the user to submit the print requests to the printer, even when the printer is not connected to the system. These requests can then be processed later using the accept command.

Syntax:

accept [ -E ] [ -U username ] [ -h hostname[:port] ] destination(s)
  • -E – causes the printer to accept requests by enabling the printer automatically.
  • -U – sets the username which is to be sent while connecting to the server.
  • -h – used to connect to a printer at a remote server

Executing accept command for the destination printer(HP-LaserJet-Professional-P1108), which is connected directly to the system.

Step 1. Get the current status of printer by using lpstat command.

lpstat -a -p HP-LaserJet-Professional-P1108

lpstat-command-linux



Step 2. Sending the request through accept command.

accept -E HP-LaserJet-Professional-P1108

request-through-accept-command

Step 3. Get the status again in order to check the request by accept command.

lpstat -a -p HP-LaserJet-Professional-P1108

check-request-accept-command

Now the print requests before the execution of the accept command, have been executed and now are not present in print queue.

To connect to a printer at a remote server.
Enter the following command to connect to a printer available at a server 120.10.100.100 and at port 631.

accept -h 120.10.100.100:631 HP-LaserJet-Professional-P1108

connect-printer-to-remote-server-using-accepts
Operation was failed here because no printer is currently available at the port mentioned. But if the printer would be connected then it will accept the request.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.