I have a long command

expac --timefmt='%Y-%m-%d %T' '%l\t%n'|sort -n | awk -F"\t" -v "Date=$(date -d'2019-08-14 12:59:00' '+%Y-%m-%d %H:%M:%S')" '$1 > Date {print $0}' | cut -f2 | xargs sudo pacman -R


  1. Prepares a list of installed packages with dates when each particular package was installed (expac command)
  2. Lists all packages which were installed after 2019-08-14 12:59:00 (awk command)
  3. Extracts only package names and omit dates in the first column (cut command)
  4. Removes each package (xargs command)

In the current settings, the command only asks for sudo password. I would also like to confirm package removal (it should ask the user to confirm the uninstallation process). I try with:

... xargs sudo pacman --confirm -R

but without success.

Thanks in advance for any pointer.

[EDIT]: Update with a solution

xargs -a <(expac --timefmt='%Y-%m-%d %T' '%l\t%n'|sort -n | awk -F"\t" -v "Date=$(date -d'2019-08-14 12:52:00' '+%Y-%m-%d %H:%M:%S')" '$1 > Date {print $0}' | cut -f2) sudo pacman -R
  • 1
    If you have a solution, please post it as an answer – muru Aug 15 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.