• 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. dstat Command Examples in Linux
  2. CentOS / RHEL 7 : How to create custom script to run automatically during boot
  3. What are the mount options to improve ext4 filesystem performance in Linux
  4. beep Command Examples in Linux
  5. How to Setup SSH keys for “passwordless” ssh login in Linux
  6. How to Disable “Predictable Network Interface Device Names” in CentOS/RHEL 7
  7. Linux OS Service ‘winbind’
  8. How to remove the multipath device after unmapping the storage LUN from server
  9. ark: command not found
  10. How to monitor /etc/shadow and /etc/passwd file for changes with Auditd?

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright