LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 01-16-2019, 06:54 AM   #1
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,726

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Question Looking for command to list certain installed apps by size.


Hi.

What command would list a few apps (e.g. geany, leafpad, pluma) and output their size in ascending order?

I saw a recent example from someone using an Arch system:
Code:
pacman -Qi lxterminal xterm | grep -i size
I'm using Debian.

Thanks.

Last edited by linustalman; 01-16-2019 at 07:03 AM.
 
Old 01-16-2019, 08:40 AM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
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... ).
 
Old 01-16-2019, 08:46 AM   #3
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
... and please tell us if you want absolute files size (ls) or resident files size on your filesystem (du)
 
Old 01-16-2019, 09:40 AM   #4
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,726

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by hydrurga View Post
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... ).
Hi hydrurga. Let's go with the former for now.
 
Old 01-16-2019, 09:41 AM   #5
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,726

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by l0f4r0 View Post
... and please tell us if you want absolute files size (ls) or resident files size on your filesystem (du)
Hi l0f4r0. Both if you can.
 
Old 01-16-2019, 10:17 AM   #6
nodir
Member
 
Registered: May 2016
Posts: 222

Rep: Reputation: Disabled
Code:
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.
 
1 members found this post helpful.
Old 01-16-2019, 10:31 AM   #7
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by linustalman View Post
I'm using Debian.

Thanks.
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.
 
Old 01-16-2019, 10:47 AM   #8
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by linustalman View Post
Hi hydrurga. Let's go with the former for now.
Beaten to it by nodir.

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.

Last edited by hydrurga; 01-16-2019 at 10:49 AM.
 
1 members found this post helpful.
Old 01-16-2019, 02:13 PM   #9
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,726

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Thumbs up

Quote:
Originally Posted by nodir View Post
Code:
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 like the first one. Thank you nodir.
 
Old 01-16-2019, 02:13 PM   #10
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,726

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Thumbs up

Quote:
Originally Posted by hydrurga View Post
Beaten to it by nodir.

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.
Perfect! Thanks again hydrurga.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to remove certain pattern files except another certain pattern files from a list? Mike_Brown Linux - Newbie 4 04-23-2016 12:30 AM
Remove files older then 30 mins of certain size with certain xtension? stefaandk Programming 5 03-17-2009 03:33 PM
How do I produce sorted list of files in current directory over a certain size? bangback Linux - Newbie 3 10-25-2006 12:11 AM
Trying to show only certain lines over a certain size in a file branall1 Linux - Software 2 11-15-2005 03:49 PM
Huge Test On Certain Apps (K Apps) br00tal Ubuntu 6 08-06-2005 01:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration