Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

List Subdomains from Shell

Discussion in 'General Discussion' started by dstana, Feb 15, 2019.

Tags:
  1. dstana

    dstana Well-Known Member

    Joined:
    Jul 6, 2016
    Messages:
    70
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    Phoenix, AZ
    cPanel Access Level:
    Root Administrator
    I'm looking for a way to generate a list of subdomains in the shell, similar to Account Information > List Subdomains in the interface.

    Usually I do something like cat /etc/domainusers which is great, but doesn't list out these subdomains. I have like 2000 domains that need to be pruned from the server, but need an easy list to loop through removing them.

    Thank you.
     
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    1,088
    Likes Received:
    445
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,923
    Likes Received:
    177
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    There is also information stored in /var/cpanel/userdata/%user%/main

    Although the API is probably the better way to accomplish this.
     
    rpvw likes this.
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,590
    Likes Received:
    2,186
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,923
    Likes Received:
    177
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    If you are looking to parse this for every user, then probably parsing the YAML file (why isn't this in json?) will be faster.

    But the API is probably the best way to guarantee that this will work.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice