Pactree - show dependencies required only for queried package

pactree shows dependencies of a package. An option I’d find useful, but can not find in the manual or else was to filter dependencies that only solely exist for the queried package .


$ pactree bash
│ ├─glibc
│ │ ├─linux-api-headers>=4.10
│ │ ├─tzdata
│ │ └─filesystem
│ │   └─iana-etc
│ ├─ncurses
│ │ ├─glibc
│ │ └─gcc-libs
│ │   └─glibc>=2.27
│ └─ncurses provides
├─readline provides
└─bashrc-manjaro provides bashrc

shows all dependencies for bash. One of those is glibc in example. glibc has close to 2000 packages depending on it on my system.

What I would like to see are only packages that are only there because bash (and no other package) depends on them.

is there a way?

Hi @vrms,


pactree --reverse <package>

Where <package> is the name of the package you want to check the dependencies of.

From the help:

$ pactree --help
-r, --reverse           list packages that depend on the named package

Hope this helps!

1 Like

I am aware of pactree --reverse <pkg_name> (which shows packages depending on <pkg_name>). But that is not what I meant. Sorry if I was not clear enough.

I’ll add an example to my Topic.

pactree pacman -d1
LANG=C pacman -Qi pacman | grep '^Depend'

this ?


see dependencies only that become orphaned if you delete the package

that would (in the bash example from above), also show glibc. So no, not what I thought of.


packages required only by one package :

 LANG=C pacman -Qi | gawk '/^Name/ {x=$3}; /^Required By     : vlc$/ {print x}'

note: exists also sub-dependencies :

LANG=C pacman -Qi | gawk '/^Name/ {x=$3}; /^Required By     : ffmpeg4.4$/ {print x}'

so, libmfx is also removed or orphan with vlc


out of curiosity … what is the leading LANG=C doing exactly?

If your language isn’t English, prepend any and all terminal commands with LC_ALL=C. For example:

LC_ALL=C bluetoothctl

This will just cause the terminal output to be in English, making it easier to understand and debug.


  • C standing for the programming language C?
  • because C only has output in English, this forces the output to be in English (even if my bash was using something else) ?


I honestly don’t know what, if anything, it stands for…I just know what it does.

1 Like

If you don’t prepend with English, “name” and “required by” in the oneliner will not work as search strings and will have to be translated too.

for me, no english man, pacman -Qi return :

Nom                      : bash
Fournit                  : sh
Dépend de                : readline  glibc  ncurses
Requis par               :

I search “Required By” or "Dépend de ", Nom/Name ? if i force english, it’s easy, i can search only “Name” and code is OK for all users

why you want this dependencies information ?

pacman -Rs package_name

remove package and unnecessary dependencies

1 Like

Yes, it refers to the programming language C, and concretely, with LC_ALL=C, you also get all of the output — e.g. the date/time format, collation, et al — in the standard C formatting.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.