System updates (en)

From Conky PitStop

Revision as of 11:44, 13 March 2011 by Wlourf (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

System updates

 Language   English   Français   


I just saw this one about a week ago. It’s a neat way to keep an eye on your system updates. Granted, most of us have a notification area in our panels or docks that alert us to such things, but I like the idea of having it in Conky, since I always keep my eyes on what’s happening with my system anyways.

A command used at the bash prompt to check for updates an give a simple numerical output would look something like this

aptitude search "~U" | wc -l | tail

Aptitude is, of course, our wonderful Debian package management system. ‘Seaitalic textrch‘ specifies that we’re using it in a search mode to find information. The “~U” is the search pattern; it specifies Updates to currently installed packages, and the output prints one package name per line of output. This brings us to wc -l (that’s a small-case ‘L’, not a number one). This is the ‘word count’ command, with the line number switch added at the end. The tail command at the very end just makes sure that all output from the previous two commands stays on just one line.

When invoked, that command will give you an output like this:

Updates-1.png

Now, let’s get that into Conky.

First, you have to give the the output a name so it’s not just a random number floating aimlessly in your Conky (unless that’s your thing…) – I call mine, oddly enough, “System Updates“. Next, we’ll want to have that command run every so often while the system is active, so the $execi variable is used. I have mine specified to run every 3600 seconds, or once an hour. Probably two or three times a day is enough, but I didn’t feel like doing the math at the time. Finally, it’s a matter of pasting the command into a .conkyrc line and seeing the output:

${color2}System Updates: $color${execi 3600 aptitude search "~U" | wc -l | tail}

Which gives exactly this in my Conky output:

Updates-2.png

From what I read, a lot can be done with the aptitude search function. Additional switches are available that can show not only an update count, but give a small description of what each update is. With some creative use of grep and cut, you could have a small list with short descriptions of all your available updates in a section in your Conky.

You can read up on all the information aptitude can show you by using the command

man aptitude

in the terminal.

Personal tools
Namespaces
Variants
Actions
Navigation
English
Français
Toolbox