You are not logged in.

#1 2005-05-31 16:11:00

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

possible feature request

I was just wondering if there was any way for pacman to monitor current disk usage of installed packages.

Finding out how big the cache is, is no problem, but it would be great to get some kind of overview of total disk usage. Might come in handy.

Offline

#2 2005-05-31 17:47:14

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: possible feature request

df -h

"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-05-31 18:59:38

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: possible feature request

df -h can give you such type of information.

du -h is also nice to see what space is used in a directory.

example :

how many MB of music do I have ?

$ cd /home/anyuser/music
$ du -h

How much space the kernel source is taking ?

cd /usr/src ; du -h

-h means "human-readable", ie the result is in bytes, Kb, Mb, Gb....
without it it would be in blocks or i don't know what other unit...

When pacman installs a package, it stores it in /var/cache/pacman/pkg.
You can safely empty that directory(either with pacman --clean or rm).

Offline

#4 2005-06-01 06:00:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: possible feature request

I think the OP is looking for something like "pacman --installed-size" so see thesize of all installed packages.

However, everything on you machine *should* be installed by pacman, so df -h will give you the same results....

Offline

#5 2005-06-01 08:16:26

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: possible feature request

I know, but considering how much a system can vary for each person, that being randomly placed files not in any way connected to pacman. I am thinking of the packages strictly installed by pacman, not including cache and similar.

Also, is there any way to keep pacman from backing up configuration files when you delete some package?

Offline

#6 2005-06-01 10:47:11

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: possible feature request

nah, don't think so, it is coded into individual pkgs, it considers situations other than just a straight remove you see

Offline

#7 2005-06-01 10:55:40

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: possible feature request

Perhaps he wants to see a list of the packages sorted by size.

Like "Windows Add/Remove Programs".


I would also say that space is rarely something to matter about in linux.

My /usr is rarely going more that 4GB... on my 40GB hardrive.

Moreover, the only purpose I myself find to 'du', is to see if something is not to big to be burnt on a cd/dvd....

Offline

#8 2005-06-01 12:04:38

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: possible feature request

postlogic wrote:

Also, is there any way to keep pacman from backing up configuration files when you delete some package?

Pacman -Rn <pkg>

Offline

#9 2005-06-08 09:37:21

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

Re: possible feature request

phrakture wrote:

I think the OP is looking for something like "pacman --installed-size" so see thesize of all installed packages.

I wrote a litle script to do this:

#!/bin/sh                                                                                                                      

function getsize {
    pacman -Ql $1|cut -d " " -f 2|grep -v /$|xargs du  -c -b|tail -n 1|cut -f 1
}

total=0

if [ $# -eq 0 ]; then
    for pkg in `pacman -Q|cut -d " " -f 1`;do
        size=`getsize $pkg`
        total=$[ $total + $size ]
        echo -e "$sizet$pkg"
    done
else
    while [ -n "$1" ]; do
        size=`getsize $1`
        echo -e "$sizet$1"
        total=$[ $total + $size ]
        shift
    done
fi

echo -e "$totalttotal"

Sortet list of all packages:

[root@arch ~]# pkgsize |sort -n
...
31273707        codecs
33108434        python
51684895        emacs
54652623        wine
68324249        glibc
73388453        gcc
713407533       total

List of single packages:

[root@arch ~]# pkgsize gcc glibc
73388453        gcc
68324249        glibc
141712702       total

Jürgen

Offline

#10 2005-06-08 10:40:15

dust
Member
Registered: 2005-06-04
Posts: 152
Website

Re: possible feature request

Rock juergen!


Writing stories for a machine.

Offline

#11 2005-06-08 11:50:22

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: possible feature request

cool - can you add human readability options?  so it's not just bytes?  maybe options for kb or mb? will be a much bigger script but ...

Offline

#12 2005-06-08 14:43:04

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: possible feature request

Could go in the new scripts section in the wiki too. :-)

Dusty

Offline

#13 2005-06-08 15:05:36

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: possible feature request

nice job jurgen!

Offline

#14 2005-06-08 19:36:17

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

Re: possible feature request

Thanks for all your positive
feedback

dibblethewrecker wrote:

cool - can you add human readability options?  so it's not just bytes?  maybe options for kb or mb? will be a much bigger script but ...

Maybe i can pass optional arguments to "du". So I can keep this script both simple and flexible. i will have a look at it later.

Jürgen

Offline

#15 2005-06-09 08:04:47

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

Re: possible feature request

juergen wrote:

Maybe i can pass optional arguments to "du". So I can keep this script both simple and flexible. i will have a look at it later.

I just updated the script, you can now pass size options to du. Output in kb:

[root@arch ~]# pkgsize -k |sort -n
...
38908   python
55172   emacs
72496   gcc
76240   glibc
702284  total

Grab it from http://www.hoetzel.info/Hacking/archlinux/pkgsize or paste it from here:

#!/bin/sh

# Usage:
# pkgsize [du_size_option] [package] ...

# default du_size_option: -b
# valid du_size_option: -k|-m|-b
# Using options -m,-k will lead to  unexact total values

# Example Usage 1 -> count size of all packages (Kb):
# pkgsize -k|sort -n

# Example Usage 2 -> count size of coreutils and glibc (Bytes):
# pkgsize  coreutils glibc


function getsize {
    pacman -Ql $1|cut -d " " -f 2|grep -v /$|xargs du  -c $du_opt|tail -n 1|cut -f 1
}

total=0                         

if [ "${1#-*}" != "$1" ]; then 
    du_opt=$1                   # du size option
    shift
else
    du_opt=-b                   # default du size option: count bytes
fi

if [ $# -eq 0 ]; then
    for pkg in `pacman -Q|cut -d " " -f 1`;do
        size=`getsize $pkg`
        total=$[ $total + $size ]
        echo -e "$sizet$pkg"
    done
else
    while [ -n "$1" ]; do
        size=`getsize $1`
        echo -e "$sizet$1"      
        total=$[ $total + $size ]
        shift
    done
fi

echo -e "$totalttotal"

Jürgen

Offline

#16 2005-06-09 10:01:16

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: possible feature request

if you want to make the size in MB, this is what I do:

        ((sizea=$total/1048576))
        ((sizeb=$total%1048576))
        sizec=`echo $sizeb | cut -c 1,2`
        size=`echo $sizea.$sizec MB`

That'll convert B's to MB's. It would be total/1024 for kB's..

Offline

#17 2005-06-11 22:02:48

deft
Member
Registered: 2005-03-14
Posts: 79

Re: possible feature request

Trivial suggestion - but....:

What does anyone think about having something like the string:

No updates available

if:

# pacman -Syu

finds no updates ???

For example - at present when we have no updates available pacman gives no explicit indication of this at all - ie, it just brings you back to the blank root prompt:

[root@myhost username]# pacman -Syu
:: Synchronizing package databases...
:: current is up to date
:: extra is up to date
[root@myhost username]#

Obviously, we know what that means, however, newer users initially might wonder what's going on......... and at any rate, it'd be nice to have a "user-friendly" confirmation that there are no updates. So perhaps after the last repo is "up to date", print "No updates available", then bring the root prompt back.

Just a thought smile - what does anyone think?

Offline

#18 2005-06-11 22:11:33

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: possible feature request

Offline

#19 2005-06-11 22:13:22

deft
Member
Registered: 2005-03-14
Posts: 79

Re: possible feature request

Thanks smile

Offline

#20 2005-06-29 20:00:53

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: possible feature request

postlogic wrote:

I was just wondering if there was any way for pacman to monitor current disk usage of installed packages.

Finding out how big the cache is, is no problem, but it would be great to get some kind of overview of total disk usage. Might come in handy.

not so bad idea, i've put it in libpypac,  8)

[root@UFU abs]# lazy-pac-cli -Qs
Total installed size:
637.5 MB

arch + gentoo + initng + python = enlisy

Offline

Board footer

Powered by FluxBB