5

Since using Linux mainly for developer purposes, I often encounter running various sudo apt-get commands downloading different tools.

These also install many dependency libraries.

Now is there a solution, through command-line or GUI, whereby it shows all apt-get commands executed for downloaded apps listing its required dependency tree?

That way it would be lovely to simply track what all stuff you did with your system.

Eliah Kagan
  • 117,780
arjun
  • 367
  • 3
  • 16
  • Do I understand correctly that your real problem is as follows? Apps need dependencies, so apt installs them. When you uninstall an app you also want to uninstall the dependencies. – user31389 Jan 27 '17 at 14:30

1 Answers1

7

TL;DR: Look in the package manager's logs, especially /var/log/apt/history.log.

To see what package management operations have been performed, I recommend consulting the APT and dpkg logs.

  • /var/log/apt/term.log shows the APT operations that have been performed. It is essentially the same text shown on the terminal when you run commands like apt-get, and date and timestamps are provided so it's clear when each operation was done.
  • /var/log/apt/history.log shows each package management operation performed by APT, who did it, what command was run to do it, and what packages and versions were affected. (This seems very similar to what you are asking for.)
  • /var/log/dpkg.log is the log for dpkg, which is the lower-level utility called by apt-get and other tools. It gives a list of operations on and statuses for each package that was added, removed, or modified, and the relevant versions.

To see the list of packages that a particular package needs (its dependencies), the packages that depend on it (its reverse dependencies), and some other information, you can run:

apt-cache showpkg package

Replace package with the actual name of the package.

Eliah Kagan
  • 117,780
  • /var/log/apt/history.log is much more useful. But it shows recent commands. Any script that would save its output time-to-time for a more historical overview? – arjun Jan 27 '17 at 12:30
  • @arjun Are you looking for information about what happened prior to the earliest entries in history.log? As logs grow and age, they're rotated into compressed .gz files: history.log.1.gz, history.log.2.gz, and so forth. The higher the number in the filename, the older the log. These are ordinary .gz files and you can open and read them the same way as any such file, but if you like using less to view .log files, then I suggest the zless command, e.g., zless history.log.1.gz. (There's also zcat.) Is that what you're looking for? – Eliah Kagan Jan 27 '17 at 12:34
  • Linux is cool! Sure there must be a command or tool which separates this list between system and user softwares. – arjun Jan 27 '17 at 12:40
  • @arjun There isn't really a clear definition of user and system software — if by user software you mean software installed locally only for that user, then such local one-user-only softwares cannot be installed through apt (unless you manually edit the package's install script). –  Jan 27 '17 at 15:47