You are not logged in.
Some days ago, while I was removing unused packages from my system, I thought it would be nice to have a tool that sorts all the installed packages by usage. Here is what I've come with after a bit of tinkering: a python script that grabs a list of all installed packages and sorts them by the last time you've accessed any of the packages' files.
The script is kinda slow since it has to read the access date of every single file of every single package (and recursively read the dependency tree, if you're using it without -d), but it gives helpful results if you're trying to get rid of that packages you've installed a long time ago and don't even remember of their existence, or if you just want some fancy statistics on which packages you use most.
Usage
Usage: lupac [OPTIONS]
Lists the installed packages sorted by usage.
-a <N>, --ago=<N> lists only packages that have not been used for <N> days or more
-q, --quiet don't display status messages
-n, --notable don't display output in a fancy table
-d, --nodeps don't check for dependencies while processing (faster, poor results)
-s, --stripdeps don't show dependencies on the output list (doesn't work with -d)
-y, --days shows for how long, in days, each package hasn't been used
-h, --help shows this help screen
Download
Install from the AUR or just download the script http://files.venox.qc.to/lupac-0.0.7a then chmod +x it.
Example output
Here's what I get on my machine after running lupac -ya 75: http://files.venox.qc.to/results.txt
(the script lists all the packages that have been unused for 75 days or more)
Last edited by venox (2008-02-16 16:39:11)
Offline
Excellent work !!
My result: http://pastebin.archlinux.fr/6324
Can you add an option to show only packages that are not requierd by others packages ?
Last edited by wain (2008-02-15 19:47:44)
Offline
I'm curious if the output is for files that you, yourself, have accessed or for any user (ie. even, say, users your create for your httpd or ftpd or mpd or what have you)?
In that case this may not even be entirely useful without some more information. Its not like this information is good enough to allow you to, with a clear concious, get rid of files that only your user has not accessed in the past, say, 300 days.
Know what I mean?
Offline
Excellent work !!
My result: http://pastebin.archlinux.fr/6324Can you add an option to show only packages that are not requierd by others packages ?
Thank you!
There's already that option, try running with -s (or --stripdeps).
I'm curious if the output is for files that you, yourself, have accessed or for any user (ie. even, say, users your create for your httpd or ftpd or mpd or what have you)?
In that case this may not even be entirely useful without some more information. Its not like this information is good enough to allow you to, with a clear concious, get rid of files that only your user has not accessed in the past, say, 300 days.
Know what I mean?
Short answer: The access time in the output is based ou any user access.
Explanation: That happens because the access times of any files on the file system are updated when any user access them. You can prove it by creating a simple file 'as a regular user and `ls -ltu` it, so you can see the access time. Then you can go as another user (or root) and read it. The access time should be updated and you'll see the difference if you run `ls -ltu` on the file again with any user. For example:
[luiz@pearl ~]$ echo "hello" > bam
[luiz@pearl ~]$ ls -ltu bam
-rw-r--r-- 1 luiz users 6 2008-02-15 18:18 bam
[luiz@pearl ~]$ sleep 2m
[luiz@pearl ~]$ sudo cat bam
hello
[luiz@pearl ~]$ ls -ltu bam
-rw-r--r-- 1 luiz users 6 2008-02-15 18:20 bam
Offline
In that case, awesome idea.
Offline
Nice work!
With the help of your script I could remove 28 packages. Thanks!
Offline
There's already that option, try running with -s (or --stripdeps).
lupac -s -ya 75 give me some packages installed as deps too: like fontcacheproto, printproto
LC_ALL=C pacman -Qi printproto | grep Reason
Install Reason : Installed as a dependency for another package
LC_ALL=C pacman -Qi fontcacheproto | grep Reason
Install Reason : Installed as a dependency for another package
Last edited by wain (2008-02-15 21:05:40)
Offline
Some days ago, while I was removing unused packages from my system, I thought it would be nice to have a tool that sorts all the installed packages by usage. Here is what I've come with after a bit of tinkering: a python script that grabs a list of all installed packages and sorts them by the last time you've accessed any of the packages' files.
The script is kinda slow since it has to read the access date of every single file of every single package (and recursively read the dependency tree, if you're using it without -d), but it gives helpful results if you're trying to get rid of that packages you've installed a long time ago and don't even remember of their existence, or if you just want some fancy statistics on which packages you use most.
Usage
Usage: ./lupac-0.0.5a [OPTIONS] Lists the installed packages sorted by usage. -a <N>, --ago=<N> lists only packages that have not been used for <N> days or more -q, --quiet don't display status messages -n, --notable don't display output in a fancy table -d, --nodeps don't check for dependencies while processing (faster, poor results) -s, --stripdeps don't show dependencies on the output list (doesn't work with -d) -y, --days shows for how long, in days, each package hasn't been used -h, --help shows this help screen
Download
Install from the AUR or just download the script http://files.venox.qc.to/lupac-0.0.5a then chmod +x it.Example output
Here's what I get on my machine after running ./lupac-0.0.5a -ya 75: http://files.venox.qc.to/results.txt
(the script lists all the packages that have been unused for 75 days or more)
Server seems down at the moment
Offline
@wain:
I'm not sure about this, but probably it was installed as a dependency for another package and it's not a dependency anymore (there are no packages that depend on it installed on your system).
Can you tell me if there are any installed packages on your system that still depend on printproto and fontcacheproto?
@strankan
Strangely, yes. The server seems to be down. You can download it from my personal webserver: http://luiz.ath.cx:8080/~luiz/lupac/lupac-0.0.5a
Edit: the server is up again.
Last edited by venox (2008-02-15 22:27:53)
Offline
@wain:
I'm not sure about this, but probably it was installed as a dependency for another package and it's not a dependency anymore (there are no packages that depend on it installed on your system).
printproto is requierd by libxp
$ LC_ALL=C pacman -Qi printproto
Name : printproto
Version : 1.0.3-1
....
Required By : libxp
...
Install Reason : Installed as a dependency for another package
fontcacheproto is requierd by libxfontcache
pacman -Qi fontcacheproto
Nom : fontcacheproto
Version : 0.1.2-1
...
Requis par : libxfontcache
...
Motif d'installation : Installé comme dépendance d'un autre paquet
Offline
That's odd. I tried running lupac -sy and lupac -y and the first one strips those printproto packages just fine.
Can you try running lupac with LC_ALL=C? I'm pretty sure your locale settings are messing with the 'pacman -Qi' parsing. If you confirm that, I'll fix it in version 0.0.6
Offline
That's odd. I tried running lupac -sy and lupac -y and the first one strips those printproto packages just fine.
Can you try running lupac with LC_ALL=C? I'm pretty sure your locale settings are messing with the 'pacman -Qi' parsing. If you confirm that, I'll fix it in version 0.0.6
Confirmed 8)
sorry, I din't realize lupac use pacman -Qi to parse database...
Offline
Confirmed 8)
sorry, I din't realize lupac use pacman -Qi to parse database...
http://files.venox.qc.to/lupac-0.0.6a
Please confirm if this new version fixes the problem with your locale settings.
Last edited by venox (2008-02-15 23:37:34)
Offline
lupac-0.0.6a doesn't work. Same locale problem :-/
Offline
What about 0.0.7a?
http://files.venox.qc.to/lupac-0.0.7a
Offline
What about 0.0.7a?
http://files.venox.qc.to/lupac-0.0.7a
0.0.7a works great with french locales
Good job !
Offline
Can you add an option to list all packages where install date = last use date ?
Offline
That's why I love Arch !!
Great stuff bro
Offline