You are not logged in.

#1 2011-01-26 05:11:58

flan_suse
Member
Registered: 2010-10-28
Posts: 120

How to print the pacman cache directory?

Is there a way to print the current cache directory with the pacman command? I know what it is set to, but for the sake of creating a script, how would you output the current pacman cache directory?

Offline

#2 2011-01-26 05:20:05

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: How to print the pacman cache directory?

/home/fukawi2 $ pacman -v
Root      : /
Conf File : /etc/pacman.conf
DB Path   : /var/lib/pacman/
Cache Dirs: /var/cache/pacman/pkg/  
Lock File : /var/lib/pacman/db.lck
Log File  : /var/log/pacman.log
Targets   : None

Offline

#3 2011-01-26 05:28:30

flan_suse
Member
Registered: 2010-10-28
Posts: 120

Re: How to print the pacman cache directory?

Totally overlooked that in the manpage. My eyes were searching for something exclusive to printing the cache directory.

This does the trick...

pacman -v | grep Cache | awk '{print $3}'

...and thank you fukawi2!

Offline

#4 2011-01-26 05:46:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to print the pacman cache directory?

If you don't change the location of the pacman config file, a single awk line will do

awk '/Cache/ {print $3}' /etc/pacman.conf

Offline

#5 2011-01-26 10:50:40

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: How to print the pacman cache directory?

karol wrote:
awk '/Cache/ {print $3}' /etc/pacman.conf

That's cool, thx smile

Offline

Board footer

Powered by FluxBB