How to list Subdomains, Addon and Parked domains of a cPanel account via command line

We all know how to list subdomains/addon domains under an account after logging to cPanel of that user. But it is a bit time consuming to log in and browse between options. There is a better and faster way to list all addon/parked and subdomains of a cPanel user provided you have SSH root access to the server.

In a cPanel server, all user configurations are stored/saved in  /var/cpanel/userdata/ inside a directory with the cPanel username of the user. ie for the cPanel user user123, the userdata directory will be ‘/var/cpanel/userdata/user123’ Now inside this directory, there will be a file ‘main’ which lists all there you can see all the domain associated with that particular cPanel account.

Eg.

root@server [~]# cat /var/cpanel/userdata/user123/main



addon_domains:

beta.in: beta.example.com

alpha.com: alpha.example.com

main_domain: example.com

parked_domains: []


sub_domains:

– apps.example.com

– blogs.example.com

– demo.example.com

– delta.example.com

– cms.example.com

– kb.example.com

When you check, be sure to replace ‘user123’ with the username of the cPanel account in question.

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.