- Unix Commands Reference
- Unix Commands - Home
accept Command in Linux
accept is a Linux command that is used to start accepting printer requests in the printer queue. When a printer is configured with your Linux system, the accept command enables the printer to start accepting the print jobs.
Even if your printer is not currently connected to your Linux system, you can still submit print jobs using this command. This command is typically used in conjunction with the LPD (Line Printer Daemon) or CUPS (Command Unix Printing System) printing systems.
It is important to note that the accept command only works when you are logged in to your Linux system as a root user. It doesn’t matter whether you are directly logging in to the root user or switching to the root using the su command.
If your printer is not accepting your printing request, you will encounter an error when you submit a printing job. However, the scheduler will still accept the request even if the printer is disabled (e.g., for paper or toner replacement).
Table of Contents
Now, let’s go through some examples to better understand the working of the accept command in Linux −
Syntax of accept Command in Linux
The general syntax to use the accept command on Linux is provided below −
accept -E -U username -h hostname:port destination(s)
Here, accept is used to invoke the command. Replace username with your desired username.destination(s) refers to the printer or print queue where you want to allow print job requests. You can specify one or more destinations separated by spaces.
Options | Description |
---|---|
-E | It enables the printer to automatically accept the request |
-U | Sets the username to be sent while connecting to the server |
-h | It is used to connect to a printer at a remote server, specifying the hostname and optionally the port |
How to Use accept Command in Linux?
Here, we will show how you can start communicating with your printer through the accept command. However, before using the accept command, ensure that the printer is connected to your system. You can enable the printer on your Linux system by using the following syntax −
enable <printer_model>
Here, replace the printer_model with the name of the printer you have connected to your Linux system.
Note − You must also ensure that the printer names contain only printable characters except SPACE, “#”, TAB, or “/”. Printer and class names are not case-sensitive.
For example, if your printer_model is laserjetV, use the following command to enable your desired printer −
enable laserjetv
You can check the status of your printer connected to your system by using the following syntax −
lpstat -a -p <printer_model>
The -a option in the above command will list all printers on the system, including both local and network printers. -p displays the status of a specific printer identified by <printer_model>.
Now, if you want to start accepting the printing request, use the accept command with the -E option followed by the printer name. The syntax to use the accept command for accepting the printing request is given below −
accept -E <printer_model>
If you want to remotely access a printer with a specific port, you can use the following syntax −
accept -h IP_address:port <printer_model>
For example, if a printer has an IP address 192.168.18.27 and operates on port 520, use the following command to start accepting printing requests −
accept -h 192.168.18.27:520 laserjetV
You can check your printer status again on your Linux system by using the following command −
lpstat -a -p <printer_model>
In this way, you can work with the accept command to start performing a printing request directly from the terminal.
Conclusion
The accept command is a vital tool for managing printer requests within the printer queue on Linux systems. You can use the -E option to enable the printer to automatically send the printing requests.
Further, you can use the -h option followed by the IP address and port number of the printer to start accepting the printing requests on your Linux system. You must also ensure to check your printer status connection and don’t forget to type your printer model for a successful connection.