Wondering how many times you have upgraded a package?

#1

Just out of curiosity I wanted to find which package I have updated the most.
Running

grep "upgraded" /var/log/pacman.log | cut -d ' ' -f 5 | sort |  uniq -c | sort -n -r | less
Walk-through

Look for the word upgraded in pacman log

grep "upgraded" /var/log/pacman.log 

Keep only the 5-th field (package name)

cut -d ' ' -f 5

Sort by name (needed by uniq)

sort 

keep only unique names while counting same occurrences

uniq -c

Sort by time upgraded in increasing order

sort -n -r

Make scrolling easier

less

you can find how many times you have upgraded any package since you installed Manjaro.

Here is my top-10.

117 mesa
106 wine
102 chromium
 99 nodejs
 98 python-setuptools
 97 pamac
 96 python2-setuptools
 91 imagemagick
 86 youtube-dl
 84 linux44
11 Likes

#2

Thanx for the command.

0 Likes

#3

thanks for the breakdown, neat to see. why sort twice, does uniq require it?

0 Likes

#4

exactly , uniq can filter adjacent lines only.

1 Like

#5

changing less with head -10 I got my top 10:

     78 mesa
     78 google-cloud-sdk
     76 lib32-mesa
     72 google-chrome
     71 wine
     70 imagemagick
     68 nodejs
     62 python-setuptools
     61 python2-setuptools
     55 linux414

which is kinda weird since this system is as old as 4 years, I probably deleted some of the history since it has been migrated (using clonezilla) twice.

2 Likes

#6

much better command end thanks for that info

0 Likes

#7

Another useful command (requires fzf):

cat /var/log/pacman.log | grep -iE 'installed|upgraded' | fzf -e +s --reverse

Search the logs by any string.

2 Likes

#8

You can check if history is missing by the first column (which corresponds to date) of /var/log/pacman.log.

0 Likes

#9

My top 10:

79 wine
78 mesa
76 lib32-mesa
76 imagemagick
73 youtube-dl
71 pamac
63 libva-mesa-driver
59 python2-setuptools
59 firefox
56 firefox-i18n-zh-tw
0 Likes