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.
—
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.