APT History Tool
View and Filter APT Package Manager Logs
The apt-history
command-line tool is designed to provide a clear and manageable way to view and filter the logs generated by the Advanced Package Tool (APT) on Debian-based Linux systems. It helps users understand package installations, removals, and other related operations, making system administration and troubleshooting more efficient.
Understanding APT Log Entries
APT logs crucial information about package management activities in files like /var/log/apt/history.log
. This tool parses these logs to present the data in a more human-readable format. You can filter these entries based on various criteria, such as the user who performed the action, the type of operation (install, remove), or specific packages involved.
Filtering APT History by User and Action
One of the most common uses of apt-history
is to track actions performed by specific users. For instance, to see all installations made by the user 'ichy', you can use the command:
apt-history -u ichy -A Install
Similarly, to filter for removals affecting a particular package, such as 'firefox:amd64', you would use:
apt-history -A Remove -p firefox:amd64
Customizing Output and Display
By default, apt-history
often pipes its output through a pager like less
or more
for easier viewing of long logs. You can disable this pagination using the -P
flag. To display log entries in reverse order (newest first) for the current user, you can combine flags:
apt-history -r -u $USER -P
For a more traditional log file appearance, without version strings but including the executed command, use the -D Wrapped
and -c
flags:
apt-history -D Wrapped -c