Last active
November 19, 2016 14:53
-
-
Save angel333/342c2cd3ccc79432aecdb11ee52cc0c5 to your computer and use it in GitHub Desktop.
This one-liner will list packages that were explicitly installed by user.
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/sh | |
# Description: Lists packages that were explicitly installed by user. | |
# Run this: curl -Ls goo.gl/RV7oiB | sh | |
export LC_ALL=C | |
MIN=2 # First is the OS installation | |
MAX=$(yum history | awk 'NR==4 { print $1 }') | |
yum history info $MIN..$MAX \ | |
| grep '\sInstall\s' \ | |
| awk '{ print $2 }' \ | |
| awk '{ sub(/\-[^\-]+\-[^\-]+$/, ""); print }' \ | |
| awk 'BEGIN { printf("\nyum install ") } { printf("%s ", $0) } END { printf "\n" }' \ | |
| awk 'BEGIN { printf("To install packages installed on this machine, enter this command:") } { print $0 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment