is there a way to list all packages by size?
pkgtool just lists it in alphabetical order.
Thanks |
ls -alS /var/log/packages | more
would be one way of listing all the packages that you have installed, one page at a time. samac |
That doesnt work properly. I was looking for something that would sort according the the installed size or as slackware mentions "uncompressed package size".
|
Code:
grep UNCOMPRESSED /var/log/packages/* | awk -F: '{print $3,$1}' | sort -rn |
Make that sort -rh to sort in 'human-readable' form.
|
The sizes are already in KiB, so -h is superfluous.
|
Quote:
|
fordfas
|
Quote:
Code:
awk -F: '/UNCOMPRESSED/ {print $2,FILENAME}' /var/log/packages/* | LC_ALL=C sort -rh | less |
My results suggest the first form is more efficient:
Code:
time grep UNCOMPRESSED /var/log/packages/* | awk -F: '{print $3,$1}' | sort -rh Quote:
Code:
time awk -F: '/UNCOMPRESSED/ {print $2,FILENAME}' /var/log/packages/* | LC_ALL=C sort -rh Quote:
|
sort -rh, thats what I was looking for, never knew the command awk existed lol. I have a lot to learn. Thanks for all our help.
|
Very Nice !
I turned the one-liner into a shell script with some options Not sure how to or if I can attach a shell script so here's the code: Code:
#!/bin/sh Code:
chmod 755 $HOME/bin/get-pkgsize -- kjh |
@allend: yep, I'm getting similar results. It appears that grep's regexp engine is faster than gawk's. Perhaps because the later supports backtracking? Although this article suggests that GNU awk uses the same approach as grep. Maybe gawk is slower in general...
|
fgrep UNCOMPRESSED /var/log/packages/* .... should be even faster
|
Interesting ...
I wonder why the complex get-pkgsize script is faster than the simple awk one-liner ? -- kjh Code:
[konrad@kjhlt5 ~]$ time fgrep UNCOMPRESSED /var/log/packages/* | awk -F: '{print $3,$1}' | LC_ALL=C sort -rh > /dev/null |
All times are GMT -5. The time now is 10:47 PM. |