How to check if a domain is on the server

Do you have a lot of domains and you want to quickly check if a domain exists on the server? Just run the shell command: grep yourdomain /etc/userdomains

root@web [~]# grep demo.plothost.com /etc/userdomains
demo.plothost.com: plothost
root@web [~]#

In this case, the domain “demo.plothost.com” exists and it belongs to user “plothost”.

You may also want to know if the domain resolves to your server/IP. Use:

root@web [~]# dig demo.plothost.com

; <<>> DiG 9.9.0-RedHat-9.9.0-38.el7_3.2 <<>> demo.plothost.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30116
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;demo.plothost.com.             IN      A

;; ANSWER SECTION:
demo.plothost.com.      5388    IN      A       162.255.100.100

;; Query time: 26 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Mar 20 04:11:52 PDT 2017
;; MSG SIZE  rcvd: 62

root@web [~]#

If the domain has a cPanel account you can search for it in WHM -> Account Information -> List Accounts:

whm search account
WHM Search Account function

On all our reseller plans you can host an unlimited number of domains. Check the offer here.

Leave a Reply