I searched the whole internet for this but did not find any satisfactory answer for this question.

aptitude search ‘~i !~M’ | less

does not show the manually installed packages. On my system it shows a huge list:

i   accountsservice                 - query and manipulate user account informat
i   acl                             - Access control list utilities             
i   acpi-support                    - scripts for handling many ACPI events     
i   acpid                           - Advanced Configuration and Power Interface
i   add-apt-key                     - Command line tool to add GPG keys to the A
i   adduser                         - add and remove users and groups           
i   alsa-base                       - ALSA driver configuration files           
i   alsa-utils                      - Utilities for configuring and using ALSA  
i   anacron                         - cron-like program that doesn't go by time 
i   apache2                         - Apache HTTP Server                        
i   apache2-bin                     - Apache HTTP Server (binary files and modul
i   apache2-data                    - Apache HTTP Server (common files)         
i   apache2-mpm-prefork             - transitional prefork MPM package for apach
i   apg                             - Automated Password Generator - Standalone 
i   apt                             - commandline package manager               

and many others...

But obviously I did not install all of these. On the other hand a much more effective solution is this:

zcat /var/log/apt/history.log.*.gz | grep 'apt-get install'


Commandline: apt-get install wine1.7 winetricks
Commandline: apt-get install ubuntu-restricted-extras
Commandline: apt-get install pi
Commandline: apt-get install gparted
Commandline: apt-get install virtualbox
Commandline: apt-get install ardour3
Commandline: apt-get install kubuntu-restricted-extras ubuntu-restricted-extras
Commandline: apt-get install apache2
Commandline: apt-get install tasksel

which are exactly the packages I installed manually. But the problem with the above solution is that the logs can be messed up. So what I want is the exact same output of the history.log file from some aptitude command. So that the log messing up won't pose any problem.


1 Answer 1


To get a list of packages installed locally run this command:

dpkg --get-selections | grep -v deinstall

you can save a file list of all installed packages

dpkg --get-selections | grep -v deinstall > myInstalledPackages.txt
  • 1
    It will also show system packages. Is there a way to get the list minus the system pkgs.
    – arjun
    Aug 18, 2017 at 8:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .