You are not logged in.

#1 2026-07-21 00:45:07

Bedna
Member
Registered: 2025-11-14
Posts: 36
Website

[SOLVED] Cat config file or download package without installing

I want to see what the default config is for the config file /etc/inputrc

$ pkgfile /etc/inputrc
core/readline

$ mkdir pkg
$ sudo pacman -Syw --cachedir pkg readline
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 multilib is up to date
resolving dependencies...

Packages (1) readline-8.3.003-1

Total Download Size:  0,40 MiB

:: Proceed with download? [Y/n] y
:: Retrieving packages...
error: could not open file /home/bedna/pkg/download-RSdhpC/readline-8.3.003-1-x86_64.pkg.tar.zst.part: Permission denied
error: failed to setup a download payload for readline-8.3.003-1-x86_64.pkg.tar.zst
warning: failed to retrieve some files
error: failed to commit transaction (failed to retrieve some files)
Errors occurred, no packages were upgraded.

$ mkdir db
$ sudo pacman -Syw --cachedir pkg --dbpath db --needed --noconfirm readline
:: Synchronizing package databases...
error: could not open file /home/bedna/db/sync/download-JKLTnd/core.db.part: Permission denied
error: failed to setup a download payload for core.db
error: failed to synchronize all databases (failed to retrieve some files)

What am I doing wrong here?

Is there an easier way to just cat the file /etc/inputrc directly via pacman, maybe using pacman -F somehow?

Thank you in advance.

Last edited by Bedna (2026-07-21 15:29:34)

Offline

#2 2026-07-21 07:39:10

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,999

Offline

#3 2026-07-21 11:24:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED] Cat config file or download package without installing

Not directly via pacman, but I wrote a short script for this same purpose some time ago:

#!/bin/sh

[ $# -lt 2 ] && exit 1

uri=$(pacman -Sp $1)
path=$(pacman -Flq $1 | grep -m 1 /$2$)

[ -z "$uri" ] && exit 1
[ -z "$path" ] && exit 2

curl -sL $uri | bsdtar xOf - $path

I call this pacdefault, and it is used as `pacdefault PKGNAME FILENAME`

This uses the local package cache if the package is currently installed (or otherwise still available in the cache) or gets it from a mirror if needed, but nothing is saved as it is curled right to bsdtar and only the requested file's contents is sent to stdout (everything else ignored / discarded).

Last edited by Trilby (2026-07-21 11:27:17)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2026-07-21 15:24:23

Bedna
Member
Registered: 2025-11-14
Posts: 36
Website

Re: [SOLVED] Cat config file or download package without installing

Trilby wrote:

Not directly via pacman, but I wrote a short script for this same purpose some time ago:

#!/bin/sh

[ $# -lt 2 ] && exit 1

uri=$(pacman -Sp $1)
path=$(pacman -Flq $1 | grep -m 1 /$2$)

[ -z "$uri" ] && exit 1
[ -z "$path" ] && exit 2

curl -sL $uri | bsdtar xOf - $path

I call this pacdefault, and it is used as `pacdefault PKGNAME FILENAME`

This uses the local package cache if the package is currently installed (or otherwise still available in the cache) or gets it from a mirror if needed, but nothing is saved as it is curled right to bsdtar and only the requested file's contents is sent to stdout (everything else ignored / discarded).

The grep won't work, pacman -Flq returns paths without leading /, but with a little modification it's a very clever way of doing it:

#!/bin/sh

[ $# -lt 2 ] && exit 1

uri=$(pacman -Sp $1)
path="${2#/}"
path=$(pacman -Flq $1 | grep ^"$path"$)

[ -z "$uri" ] && echo "$1 does not exist" && exit 2
[ -z "$path" ] && echo "$2 does not exist in $1" && exit 3

curl -sL "$uri" | bsdtar xOf - "$path"
exit 0

Or simplified by only providing the path to the file (if only one package provides the file), eg: `./pacdefault FILENAME`:

#!/usr/bin/env bash

[ $# -lt 1 ] && echo 'no path provided' && exit 1

pkg=$(pkgfile "$1")

[ -z "$pkg" ] && echo "no package found for $1" && exit 2

uri=$(pacman -Sp "$pkg")
path=${1#/}

curl -sL "$uri" | bsdtar xOf - "$path"
exit 0

Thank you both!

Last edited by Bedna (2026-07-21 16:04:06)

Offline

#5 2026-07-22 19:09:22

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,999

Re: [SOLVED] Cat config file or download package without installing

I suspect Trilby calls "pacdefault readline inputrc" and you called "pacdefault readline /etc/inputrc"
The former works (most of the time, unless the file resides in /) but is inherently ambiguous (try that w/ some "settings.ini" wink)

Offline

#6 2026-07-23 02:21:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED] Cat config file or download package without installing

It would work fine with a settings.ini and is not really that ambiguous.  Very few packages contain a two files with the same name - and if they did, you'd probably want to see both of them.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2026-07-23 05:51:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,999

Re: [SOLVED] Cat config file or download package without installing

settings.ini was just the most generic bland filename I came up with and I assume if this was a frequent problem you'd have changed the script, but

path=$(pacman -Flq $1 | grep -m 1 /$2$)

will not show both files.

Anyway, I mostly wanted to point out why you disagreed on "does this works the way it's is?"

Offline

#8 2026-07-23 15:38:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,491
Website

Re: [SOLVED] Cat config file or download package without installing

Oops, okay, it will not find both files in a given package.  But I read your critique as the script having ambiguity among all the possible settings.ini in any package in the repo (which could happen with `pacman -F settings.ini`) but that hurdle isn't applicable here.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB