1

I'm trying to see if I can learn something more about disk usage on my setup - with respect to installed packages(all). So I'm looking at the Arch Pacman Tips about maintenance. First I try :

expac -HM -s "%-30n %m" | awk '{s+=$2} END {print s}'
3785.87 (Mb)

I know this is about right. Then I try:

pacsysclean | awk '{s+=$1} END {print s}'
151634

Both commands before the pipe operator with wc -l yield the same number of packages. What is that number output by pacsysclean? Did I misuse awk in any way here? I've tried an optional assignment before the command i.e. LC_ALL="C" command to make sure it wasn't related to my locale. Result is identical.

1 Answer 1

1

No, you haven't misused awk; it is more a case of (slightly) misusing pacsysclean.

expac is explicitly designed for extracting and parsing alpm data: the results you are seeing from it are accurate.

pacsysclean is not really inteded to be parseable, it simply sorts packages by their installed size. As a result, the unit size changes between MiB and KiB once the package size passes that threshold, consequently awk sums the column of integers indiscriminately.

Stick with expac for parsing and pacsysclean for a quick sort.

2
  • Units, thank you! I had scrolled but was really focused on the numbers, and lines.
    – user44370
    Nov 21, 2014 at 7:45
  • 1
    @Amphiteóth It's pretty rare for anyone to scroll that far back through pacsysclean output: most just focus on the heavy end... :)
    – jasonwryan
    Nov 21, 2014 at 7:46

You must log in to answer this question.