nach manuell installierten Paketen suchen
Ab und zu muss möchte man wissen, wann man ein tool installiert hatte.
Dieses Script ermöglicht auf einfache Weise nach Installationsdaten von Paketen zu suchen, indem es sowohl die APT-Logs als auch die Bash-History durchsucht.
installed.sh
#!/bin/bash
# installed.sh
# $Revision: 1.2 $
# Dieses Script ermöglicht auf einfache Weise nach Installationsdaten von Paketen zu suchen.
# indem es sowohl die APT-Logs als auch die Bash-History durchsucht
clear
bold=$(tput bold)
normal=$(tput sgr0)
gruen=$(tput setaf 2)
rot=$(tput setaf 1)
black=$(tput setaf 0)
# Eingabedialog
whiptail_eingabe=$(whiptail --title "Suche nach Installationsdatum" --backtitle="Suche nach Installationsdatum eines oder mehrerer Pakete" --inputbox "Suchstring" 10 50 3>&1 1>&2 2>&3)
# Header
echo "$bold=== Installierdatum ${rot}Pakete${normal}${bold} ===${normal}"
# Suche in /var/log/apt/history.log*
SUMPAC="$(zgrep -hsB1 "Commandline: apt install" /var/log/apt/history.log* 2>/dev/null | sed 's/Commandline: apt install //')"
echo "$SUMPAC" | sed '/^--$/d' | sed 's/Start-Date://' | awk 'BEGIN {ORS=" "} {if (NR%2==0) print "\t" $0 "\n"; else printf "%s", $0}' | grep -i --color "$whiptail_eingabe"
# Suche in der Bash-History
echo "$bold=== Bash-History ${rot}Einträge${normal}${bold} ===${normal}"
grep -i "apt install" ~/.bash_history | grep -i --color "$whiptail_eingabe"