October 11, 2006

CPanel accounts

How to list all of your CPanel account names by running a c-shell script from the command line.

1) Create a new file in your /home directory called accounts.com (vi accounts.com)

2) Paste the following into accounts.com

#!/bin/csh
foreach dir (`ls -AF /home/ | grep / | grep -v “\.”`)
echo $dir
end

3) Save and exit the file (:wq)

4) Change the permissions on the accounts.com file, chmod +x accounts.com

5) Run the script, /home/accounts.com

Some more useful stuff (without any explanation):

#!/bin/csh
foreach dir (`ls -AF /home/ | grep / | grep -v “\.”`)
foreach subdir ( `ls -aF /home/$dir\public_html | grep / | grep -v “\.” | egrep -v “cgi-bin|images”` )
\cp /home/style.css /home/$dir\public_html/$subdir\includes/style.css
end
end

#!/bin/csh
foreach dir (`ls -AF /home/ | grep / | grep -v “\.”`)
foreach subdir ( `ls -aF /home/$dir\public_html | grep / | grep -v “\.” | egrep -v “cgi-bin|images”` )
ls /home/$dir\public_html/$subdir\includes/style.css
end
end

#!/bin/csh
foreach dir (`ls -AF /home/ | grep / | grep -v “\.”`)
echo $dir
end

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
    del.icio.us digg Fark YahooMyWeb Reddit blinkbits BlinkList blogmarks co.mments connotea De.lirio.us feedmelinks Furl LinkaGoGo Ma.gnolia NewsVine Netvouz RawSugar scuttle Shadows Simpy Smarking Spurl TailRank Wists
Filed under Web by admin.
Permalink • Print •