Before switching to a new ROM, I wanted to keep a list of currently installed packages on my phone for reference. There are two ways to get this done. Both require Android Debug Bridge (adb) to be installed on the system.
Use adb to get a list of installed packages and then dump the output to a file.
adb shell pm list packages > ~/installed_packages.txt
The file
packages.xml
located at/data/system/
contains all information about the installed packages. You can backup this to a safe locationadb pull /data/system/packages.xml ~/
This thread at android.stackexchange.com saved me.