List Subdomains, Addon domains and Parked domains of a cPanel account via command line

Yeah, it’s possible to sort out all associated domains (Subdomains, Addon-domains and Parked-domains) for a cPanel account via command line.

This will be helpful for server admins to sort out all associated accounts simply and quickly from the command line.

In a cPanel server, there is a file “main” in “/var/cpanel/userdata/$username” (where $username is the actual username) which stores all accounts details associated with it. From there you can see all the domain associated with that particular cPanel account.

Please see the sample output pasted below:

1. Log into server as root.

2. View the file as I mentioned.

root@server10 []# cat /var/cpanel/userdata/test123/main
---
addon_domains: {}

cp_php_magic_include_path.conf: 0

main_domain: test123.com

parked_domains: []

sub_domains:
  - sub.test123.com
---

Where test123.com is the domain name and test123 is the username.

How to change main domain of a cPanel reseller account with an existing domain name?

Hey!! Here are some tips on cPanel reseller account modification.

It’s quite simple if the new domain you wish to set as primary of your WHM re-seller is not under the same account. It can be simply managed from the “Modify an Account” section. You can simply modify the account information from this location. As it is a re-seller, you must do the following steps after modifying the account.

You can also list this from the WHM.

1. Log into WHM panel.

2. Under “Account Information” tab,

>> List Parked Domains – To list all parked domains with original domain details.
>> List Subdomains – To list Subdomains, Addon Domains and Parked Domains.

WHM-list

If you have only the cPanel access, then follow these steps to list them:

1. Log into cPanel.

2. Uder “Domains” tab you will get all associated accounts.

>> Subdomains
>> Addon Domains
>> Parked Domains
cpanel-list

That’s it!!

Related posts:

1, How to change main domain of a cPanel reseller account with an existing domain name?
2, The XCache – Simple way to install Xcache from source code
3, How to check cPanel rpm works or not – cPanel script to check rpm
4, Simple steps to install CloudFlare plugin on cPanel server

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

4 thoughts on “List Subdomains, Addon domains and Parked domains of a cPanel account via command line

  1. Wonderful informative stuff thanks for sharing. I don’t need that, but good to have some knowledge about it.

  2. Hello Arun,

    I am new to this Stream so want to know from you whether your above process of a domain is same for all servers hosting providers or not?

    Regards,
    Brijesh

Leave a Reply

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