3

The question unix.SE/3595 asks how to list packages that I explicitly installed. By explicit it means, packages that I choose, not including anything installed by default, or pulled in by the dependencies.

Is there a similar command to find packages that were explicitly removed?

n611x007
  • 957
  • 3
  • 11
  • 21

3 Answers3

5

The following command will list all packages which have ever been removed (or purged), as far back as apt's history allows:

zgrep -E '^(Remove:|Purge)' /var/log/apt/history.log*

This does not distinguish automatic removals from explicit removals, but with a little work you should be able to reconstruct that information.

If you always use the command line, then

zgrep -E ^Commandline /var/log/apt/history.log*

will show you all the commands you issued, which will include explicit removals. You could filter it to only list remove or purge, but that won't include other forms of removals.

If you remove packages using dpkg, that won't appear in apt's logs; you'd need to look at /var/log/dpkg.log and search for remove or purge.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
1

I don't know a way to do this using apt, but you may try searching your bash history:

grep 'apt-get .*remove' ~/.bash_history

This should output all lines with remove or autoremove.

MatthewRock
  • 6,826
  • 6
  • 31
  • 54
  • That's what I do, it's a good poor man's listing. But not every terminal session is saved to bash history. See eg. [unix.SE/1288: Preserve bash history in multiple terminal windows](https://unix.stackexchange.com/questions/1288/); maybe including connection loss, screen/terminal multiplexer, who knows what, some of which already effects me. – n611x007 Aug 25 '15 at 10:30
  • 1
    You may want to check this topic: http://askubuntu.com/questions/425809/where-are-the-logs-for-apt-get Basically you can try searching various logs of apt and see if there is anything you can fit into some pattern. – MatthewRock Aug 25 '15 at 10:42
0

There should be logs located at /var/log/apt/history.log that contain your past actions with apt.

chaos
  • 47,463
  • 11
  • 118
  • 144
Centimane
  • 4,420
  • 2
  • 21
  • 45