Home / Control Panel / List addon domains, parked domains and sub domains via command line – cPanel

List addon domains, parked domains and sub domains via command line – cPanel

Hello all,

I was struggling to get the details of a domain from my WHM control panel as it did not list the domain name I searched under the “list accounts” option. In the dig result I found the account hosted on the same server. Situations like this can come and using the web interface can make us mad at times. We are lucky as there are ways to check all these from command line.

In the WHM control panel under the “list accounts” option, it will not list parked and addon domains so it’s tough to get details of a user or his accounts. We can get the help of grep command and list the these accounts easily. The methods are given below, please read through.

In cPanel, there is a file called main associated with all user accounts created on the server, this file contains the info about main domain, sub domains and addon domains. We can view this file using the cat command, see how it displays its contents:

Path of the “main” file: /var/cpanel/userdata/$username

example:
root@nixlinux [~]# cat /var/cpanel/userdata/<strong style="color:red;">football</strong>/main --- addon_domains: {} cp_php_magic_include_path.conf: 1 main_domain: footballforlife.com parked_domains: [] sub_domains: - store.footballforlife.com - tickets.footballforlife.com root@nixlinux [~]#
In the above footballforlife.com is the domain name and football is the username.

A screenshot of a real server output is also given below for helping you to a little more extend:

How to search for an addon/sub/parked domain on the entire server using command?

You can go for the below command to do this, please replace the string mentioned in the quotes with the domain name you need to search for:
# root@nixlinux [~]# grep -R "domain_name" /var/cpanel/userdata/*/main

Please check the below example to have a clear idea:

I am here searching for “webcrase” to see if something similar to it present on the server as an addon/park/sub domain on the server, below is the result I got:

How to list parked/sub/addon domain details from WHM?

As you know you can also do it from the WHM but the advanced searching might not be possible, do the steps below to do it.

  1. Log into WHM control panel.
  2. Search for “list parked domains” in the search bar at the left top corner.
  3. Check the below screenshot for more info:

4. You can also search for “list sub domains” in the search and you will get something like below.

  1. In the columns you will be able to see a domain and it’s associated domains details.

That’s all guys, thanks a lot for reading!!! ๐Ÿ™‚

Jishnu KS

2 comments

  1. Hi Jishnu

    Could you please explain if there is no control panel then how we list domain,parked domain,sub domain,? if my question is point less please ignore this.

    • Hi Rahul, first of all thanks for your comment! The command line option to list the required info on cpanel servers is explained in this blog, as the each control panels have their own path for files this varies from one another. Let me come up with those in the upcoming blogs bro! ๐Ÿ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate ยป
Social Media Auto Publish Powered By : XYZScripts.com