Use “yay” instead of yaourt! yaourt is outdated. (https://github.com/Jguer/yay)
yay -Yc
pacman -U .pkg.tar.gz or .pkg.tar.xz
pacman -Qqen > pkglist.txt
pacman -Qqem > pkglist_aur.txt
yay -S --needed - < pkglist.txt
Source: https://wiki.archlinux.org/title/Migrate_installation_to_new_hardware
pacman -Qo file
pacman -F file
pacman -Ql package
pacman -R --dbonly package
pacman -Rns $(pacman -Qdtq)
Explanation of the Command Option Description -R Remove the specified packages. -n Remove configuration files along with the packages. -s Also remove dependencies that were installed exclusively for the packages being removed. $(pacman -Qdtq) This part lists all orphaned packages, which are dependencies no longer required by any installed package.