How to get a list of all modules in Magento

I was recently asked to generate a list of all of the modules in a copy of magento.

To this I put together this quick one-line bash command to go through the modules folder and output the content

cat /path/to/magento/app/etc/modules/* | grep -B 1 “<.*active” | grep -v “<.*active” | sed ’s/<//g’ | sed ’s/>//g’ | awk ‘{print $1}’ | sort | uniq > /path/to/file

If you just the active modules then run this instead cat /path/to/magento/app/etc/modules/* | grep -B 1 “<.*active.*true” | grep -v “<.*active” | sed ’s/<//g’ | sed ’s/>//g’ | awk ‘{print $1}’ | sort | uniq > /path/to/file