You are not logged in.
Pages: 1
By a youth / stupidity ponastavil any different software packages which are now not using, as if to find all unused packages and carry them?
Maybe there is some special tool or means pacman can do that?
Thanks in advance
Offline
If the packages were explicitly installed, then the only way is to explicitly remove them. You may want to list your packages by their install date (the method was described here: https://bbs.archlinux.org/viewtopic.php?id=86110), or inspect you pacman.log to remove the desired/most recent items, but more "educational" is a study of /var/lib/pacman/local, which prevents from future extensive installing. ; )
If you want to remove obsolete dependencies, then
pacman -Qdtworks fine.
Last edited by bohoomil (2011-03-27 11:08:32)
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Get pacgraph from the AUR and you can see packages roughly by size via the -c switch.
Offline
It's a bit of everything is not something I would like to know what packages I did not address such a month and then remove them
Offline
It's a bit of everything is not something I would like to know what packages I did not address such a month and then remove them
I don't believe there is such an app.
Offline
But that would be cool for analysis. Find with atime parameter could be used for..
Offline
How about 'ls -ltu'?
I can't test this, because I've disabled atime in fstab.
Last edited by thisoldman (2011-03-27 21:09:16)
Offline
I've write a not efficient python script for this. It seems to work ![]()
#!/usr/bin/python
import os
import time
import re
import sys
from datetime import datetime, timedelta
def list_unused_packages(days):
'''
list packages not acessed in arch for n days
it checks if any of files in package were acessed before n days,
if not add it to list of unused_packages.
'''
lt_time = datetime.now() - timedelta(days=days)
epoch_lt_time = time.mktime(lt_time.timetuple())
# get list of installed packages
installed_packages = os.popen('pacman -Q').read().split('\n')[:-1]
unused_packages = []
for package in installed_packages:
# get files of package
files = os.popen('pacman -Ql ' + re.match('^.* ', package).group())
files = files.read().split('\n')[:-1]
acessed = False
for path in files:
valid_file = re.search(' (.*\w)$', path) # exclude directories
if valid_file:
try:
atime = os.path.getatime(valid_file.group(1))
if atime > epoch_lt_time:
acessed = True
break
except OSError:
# broken symlink?
pass
if not acessed:
unused_packages.append(package)
return unused_packages
if __name__ == '__main__':
try:
unused_packages = list_unused_packages(int(sys.argv[1]))
print ('\n'.join(unused_packages))
if unused_packages:
print ('packages not used for at least {0} days'.format(sys.argv[1]))
else:
print ('all packages were acessed.')
except IndexError:
print ('usage: unused_packages days')Last edited by vae77 (2011-03-27 21:32:28)
Offline
Make the code quick and dirty, not the execution! Though, on my SSD, this is actually pretty quick (less than 3s).
#!/bin/bash
declare -A usage
exec 0< <(pacman -Ql | grep bin)
while read pkg binary; do
lastused=$(stat -c '%X' "$binary")
if [[ -z ${usage[$pkg]} ]] || (( lastused > ${usage[$pkg]} )); then
usage[$pkg]=$lastused
fi
done
for key in "${!usage[@]}"; do
printf '%s\t%s\n' "${usage[$key]}" "$key"
done | sort -rn | while read time pkg; do
printf '%(%c)T\t%s\n' "$time" "$pkg"
doneThis doesn't actually work for folks who set noatime on their drive though, e.g.:
Mon 17 Jan 2011 01:48:41 PM EST lessI have a funny feeling I've used less since January.
Offline
your code have an error
Offline
your code have an error
More info would be welcome.
Offline
Pages: 1