Created
July 10, 2019 02:23
-
-
Save loopyd/513a14fda32808272b0efafc91586f4f to your computer and use it in GitHub Desktop.
[ArchTricks] Uninstall last x packages
This file contains hidden or 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 | |
# ArchTricks pacrevert.sh | |
# By: HeavyPaws "Heavy H. Paws" <[email protected]> | |
# | |
# About: | |
# This script will remove the last n packages specified by its first argument | |
# | |
# Packages are sorted by date. If you ever fuck up and your system won't boot because of a bad group of packages, this | |
# script is your life preserver. | |
# | |
# Dependencies required: expac: pacman -Sy expac | |
# Shell required: /bin/bash | |
# | |
# Usage Example: | |
# | |
# pacrevert.sh 50 | |
# Will remove the last 50 installed packages | |
# | |
# WARNING: This command ignores dependencies. If you don't know what the hell you're doing, I'd advise not | |
# using this script at all! Be a good sysadmin and accept responsibility for your own fuckups! :-) | |
# | |
local ln | |
local lx | |
lx=$1 | |
ln=$(expac -Ql --timefmt=%c '%l\t%n' | sort -n | awk -F ' ' '{print $6}' | tail -n$lx | tr '\n' ' ') | |
sudo pacman -Rdd $ln |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment