Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # apt-list - A script to show packages installed with apt-get
- #
- # Usage: apt-list <installed|removed|kept>
- #
- # G+ Post: https://plus.google.com/+JessiBaughman/posts/7USUQfh3y7y
- # Created by: Jessi A. Baughman
- # Last Modified: 2018-09-06
- if [[ $1 == "installed" ]];then
- awk '$0 ~ "install " {if ($4 != "install" && $4 != "-y" ) print $4}' /var/log/apt/history.log | awk '!x[$0]++' | sort
- elif [[ $1 == "removed" ]];then
- awk '$0 ~ "remove " {if ($4 != "remove") print $4}' /var/log/apt/history.log | awk '!x[$0]++' | sort
- elif [[ $1 == "kept" ]];then
- awk '$0 ~ "install " {if ($4 != "install" && $4 != "-y") print $4} $0 ~ "remove " {if ($4 != "remove") print $4}' /var/log/apt/history.log | awk '{!seen[$0]++};END{for(i in seen) if(seen[i]==1)print i}' | sort
- else
- echo
- echo "Usage: apt-list <installed|removed|kept>"
- echo
- fi
Add Comment
Please, Sign In to add comment