How to save list of installed packages on Debian/Ubuntu

dpkg -l > ~/packages.txt
 29   3 mon  
Popular