How to save list of installed packages on Debian/Ubuntu

dpkg -l > ~/packages.txt
 22   1 mon  
Popular