To get all the email ID contains for a domain

Below script is to find email accounts for all domains –> to find for one domain fire command like this —> sh | grep
for d in `cat /etc/virtual/domains`; do
       #system account
       S=`grep “^${d}:” /etc/virtual/domainowners | cut -d: -f2 | awk ‘{print $1;}’`
       if [ “${S}” != “” ]; then
               echo “${S}@${d}”;

       if [ ! -s /etc/virtual/$d/passwd ]; then

       for e in `cat /etc/virtual/$d/passwd | cut -d: -f1`; do
               echo “${e}@${d}”;
exit 0;

execute the above script with  sh | grep domain

Leave a Comment

Pin It on Pinterest

Share This
Open chat