• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Add Network Printer via Command Line in CentOS/RHEL

by admin

This post explains the steps to add a network printer on a Linux Server.

1. Verify if new printer already exists

# lpstat -p
Note: This command will list all installed printers.

2. Verify if printer has a DNS record:

# host [printer name]

3. If error found in verifying if printer has a DNS record, modify /etc/hosts:

# echo "[printer IP address] [printer name]" >> /etc/hosts
Note: Modifying /etc/hosts can be done manually by using vi command.

4. Add printer:

# lpadmin -p [printer name] -E -v socket://[printer name]:[port]

5. Verify if printer has been installed successfully:

# lpstat -p | grep [printer name]

or

# ping [printer name]
Note: Do not modify /etc/cups/printers.conf configuration file directly. Use the lpadmin command to add or remove printers.
How to Remove Network Printer in CentOS/RHEL

Filed Under: CentOS/RHEL, CentOS/RHEL 6, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. srun Command Examples in Linux
  2. sudoedit: command not found
  3. ajson – Executes JSONPath on JSON objects (Command Examples)
  4. tcptraceroute: command not found
  5. kpackagetool5 Command Examples in Linux
  6. free: command not found
  7. How to use ipset Command in Linux
  8. getfacl: command not found
  9. getopt: command not found
  10. zcat Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • “az storage blob” Command Examples (Manage blob storage containers and objects in Azure)
  • “az storage account” Command Examples (Manage storage accounts in Azure)
  • “az sshkey” Command Examples (Manage ssh public keys with virtual machines)
  • “az redis” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright