I'd like to get a list of packages installed manually by apt or aptitude and be able to find out whether a foobar package was installed manually or automatically. Is there any neat way of doing that from the command line?
|
|
|||||||||||||||||
|
|
You can use either of these two one-liners. Both yield the exact same output on my machine and are more precise than all solutions proposed up until now (July 6, 2014) in this question. Using
Using
Very few packages still fall through the cracks, although I suspect these are actually installed by the user, either right after the installation through the language localization setup or e.g. through the Totem codec installer. Also, the linux-header versions also seem to accumulate, even though I've only installed the non version-specific metapackage. Examples:
How does it work:
Other possibilities don't work as well:
I used various other StackExchange posts as references, however none work as well as the above solution: Both list more packages than the above solution. EDIT: What to do if you've upgraded from a previous release: If you've upgraded Ubuntu from one release to the next, you will probably need to adjust this process. In that case, I would check the manifest file of the newer release (see above) in addition to the initial-status.gz file from the current release. You can easily do that by just adding another comparison. Using just the manifest file will not work, as the manifest file unfortunately does not contain everything that the initial_status.gz file does (I checked). |
|||||||||||||
|
|
In newer versions of the package apt, there is also the apt-mark command
|
|||||||||||||||||||||
|
|
|
|||||||||||||||||||||
|
|
The following script will print out all the packages that are not set to automatic install and hence were installed manually:
it is based on how apt-mark prints out the automatically installed packages. |
|||||||||||||||||
|
|
For Ubuntu 16.04, check out the log file For example:
It's not perfect, but it's pretty good at making it clear exactly what I installed by hand. Put a Example output
Not sure if this picks up |
||||
|
|
|
As several people have commented, apt-mark showmanual seems to be a bit buggy (and I reported it as bug 727799). When I'm using it, it actually reports a lot of stuff that isn't even logged in /var/lib/apt/extended_states (where this is supposed to be stored) and apt-get isn't logging things as installed in /var/lib/apt/extended_states (just in /var/lib/dpkg/status). The python script by txwikinger above draws from /var/lib/apt/extended_states directly but if you're using it today the syntax might not work (mine just started generating errors with Kubuntu 13.10). Updated syntax is:
For me this was a very short list of 5 items which doesn't seem to be accurate either. |
|||||
|
|
To get a list of all packages (not installed, installed by user or installed by default, across all PPAs),
The possible options useful for this are:
Alternatively, you could do:
|
|||
|
|
|
As Li Lo said, Now to show the things that are installed manually, it turns out there's a lovely simple search modifier for aptitude. But you don't want to to do that. You want to write a huge bash command that does some rocket science. Note: This is more an illustration of how cool you'll look busting out massive bash commands to all your friends.
I broke it onto two lines for readability. What does this do?
|
|||||||||||||
|
|
If no one gives you a nice answer using a apr-something command you can do it the hard way. Apt-get stores its info in /var/lib/apt/extended_states. Any file that is installed automatically will be added to this file. If you install a package already in this file manually, the package will remain in this file but with Auto-installed: 0 in the second line. It's not deleted. Note: As expected better answers that are likely to work if file placement changes have appeared. I keep mine just in case the info on the file location is useful. |
|||||||||
|
|
After googling a lot, I've managed to assemble this script. It works alright for me:
|
|||||||||||||
|
|
This will list all manually installed packages without: dependencies, uninstalled packages, packages installed during system installation.
|
||||
|
|