Talk:Pacman/Tips and tricks

From ArchWiki
< Talk:Pacman
Revision as of 04:20, 8 October 2013 by Gdiscry (talk | contribs) (Listing all packages that nothing else depends on: new section)
Jump to: navigation, search

Listing changed configuration files

Regarding the shell script to manually list the configuration files that have changed, I wrote the following script instead that only uses awk to process the /var/lib/pacman/local/*/files:
cat /var/lib/pacman/local/*/files | awk '
    /^$/ { backups = 0 }
        if (backups) {
            $1 = "/"$1
            if ($2 == "(null)") {
                if (! system("test -e "$1)) {
                    print "d41d8cd98f00b204e9800998ecf8427e "$1
            } else {
                print $2" "$1
    /^%BACKUP%$/ { backups = 1 }
' | md5sum -c --quiet

It supports empty/non-existent files that have (null) instead of a hash but does not list to which package owns a file. --Gdiscry (talk) 03:55, 8 October 2013 (UTC)

Listing all packages that nothing else depends on

The following script should have the same result without (explicitly) using temporary files and by using pacman to query the top-level packages:


# This script is designed to help you clean your computer from unneeded
# packages. The script will find all packages that no other installed package
# depends on. It will output this list of packages excluding any you have
# placed in the ignore list. You may browse through the script's output and
# remove any packages you do not need.

# Enter groups and packages here which you know you wish to keep. They will
# not be included in the list of unrequired packages later.
ignoregrp="base base-devel"

comm -23 <(pacman -Qqt | sort) <(echo $ignorepkg | tr ' ' '\n' | cat <(pacman -Sqg $ignoregrp) - | sort -u)

--Gdiscry (talk) 04:20, 8 October 2013 (UTC)