comm -23 <(pacman -Qqe | sort) <(pacman -Qqg base base-devel | sort) | sort -n
expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqe | sort) <(pacman -Qqg base base-devel | sort)) | sort -n
comm -13 <(pacman -Qdtq | sort) <(pacman -Qdttq | sort)
Note: Run pacman -Qi on any package in the output to see which package it is Optional For. If you run pacman -Qi with those packages, too, you usually get a description of the functionality the optional dependency provides. See also: https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks https://wiki.archlinux.org/index.php/System_maintenance Slightly related: List packages by their install date
expac --timefmt="%F %T" "%l %w %n" | grep explicit | cut -d ' ' -f 1-2,4- | sort -n