[SOLVED] Looking for command to list certain installed apps by size.
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The thing is, there is a difference between the size of a package and the size of the disk space that a package and its configuration files take up on your disk once the package is installed and run. Finding the former is easy but the latter is more difficult as it would involve having to add together the sizes of all the files and configuration files connected to the package wherever they are on the disk, bearing in mind that some of these files may be jointly shared with other packages/applications. And that's before we take dependencies into account.
So which of these are you looking for? (please say the former... ).
The thing is, there is a difference between the size of a package and the size of the disk space that a package and its configuration files take up on your disk once the package is installed and run. Finding the former is easy but the latter is more difficult as it would involve having to add together the sizes of all the files and configuration files connected to the package wherever they are on the disk, bearing in mind that some of these files may be jointly shared with other packages/applications. And that's before we take dependencies into account.
So which of these are you looking for? (please say the former... ).
apt-cache show leafpad geany pluma| grep -i '^package\|size'
i think i prefer:
Code:
for i in leafpad geany pluma; do apt-cache show "$i" | grep -i '^package\|size'; printf "\n"; done
how to sort that is beyond me.
Code:
for i in geany leafpad pluma; do apt-cache show "$i" | grep -i '^installed-size:'; done | sort -V
for i in geany leafpad pluma; do apt-cache show "$i" | grep -i '^size:'; done | sort -V
run separate do sort, but lack the name of the package.
I have NO idea if the installed packages database keeps those sizes in Debian, it is pure package manager dependant.
I.e. in Slackware it is
Code:
grep "PACKAGE SIZE:" /var/log/packages/{list of packages}|sort -k 4 -n
or, in -current (the PATH has been changed in recent versions):
grep "PACKAGE SIZE:" /var/lib/pkgtools/packages/{list of packages}|sort -k 4 -n
and to get just the uncompressed size
grep "UNCOMPRESSED PACKAGE SIZE:" <rest of the command line>
which works because in Slackware the installed package list contain just plain text files.
Just to add that this can also be done by using dpkg-query but this only works for packages installed on your system whose details are contained within the dpkg database.
Code:
for i in leafpad geany pluma; do dpkg-query -Wf '${Installed-Size}\t${Package}\n' "$i" | sort -n; done
Note also that calling apt show rather than apt-cache show gives a slightly different figure and adds a kB on the end.
apt-cache show leafpad geany pluma| grep -i '^package\|size'
i think i prefer:
Code:
for i in leafpad geany pluma; do apt-cache show "$i" | grep -i '^package\|size'; printf "\n"; done
how to sort that is beyond me.
Code:
for i in geany leafpad pluma; do apt-cache show "$i" | grep -i '^installed-size:'; done | sort -V
for i in geany leafpad pluma; do apt-cache show "$i" | grep -i '^size:'; done | sort -V
run separate do sort, but lack the name of the package.
Just to add that this can also be done by using dpkg-query but this only works for packages installed on your system whose details are contained within the dpkg database.
Code:
for i in leafpad geany pluma; do dpkg-query -Wf '${Installed-Size}\t${Package}\n' "$i" | sort -n; done
Note also that calling apt show rather than apt-cache show gives a slightly different figure and adds a kB on the end.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.