Created
July 26, 2019 20:28
-
-
Save matthiasroos/f8dcfd31c662a3dff3e2b33fce1d21d2 to your computer and use it in GitHub Desktop.
Get command history for APT package manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
workdir=`pwd` | |
mkdir /tmp/apthistory | |
cd /tmp/apthistory | |
cp /var/log/apt/history.log* . | |
gunzip history.log.*.gz | |
nr=`ls | wc -l` | |
list="" | |
for i in `seq $[nr-1] -1 1`; | |
do | |
list="$list history.log.$i" | |
done | |
list="$list history.log" | |
datum=`date +%Y-%m-%d` | |
cat $list > "$workdir/history.log_$datum" | |
cd | |
rm /tmp/apthistory -rf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment