You are not logged in.
Pages: 1
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
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
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
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
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
nah, don't think so, it is coded into individual pkgs, it considers situations other than just a straight remove you see
Offline
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
Also, is there any way to keep pacman from backing up configuration files when you delete some package?
Pacman -Rn <pkg>
Offline
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
Rock juergen!
Writing stories for a machine.
Offline
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
Could go in the new scripts section in the wiki too. :-)
Dusty
Offline
Offline
Thanks for all your positive
feedback
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
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
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
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 - what does anyone think?
Offline
its been discussed:
http://bbs.archlinux.org/viewtopic.php?t=11548
Offline
Thanks
Offline
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
Pages: 1