1

I am working on a school project in a limited environment (archlinux) where I don't have root access. The subject says that I am allowed to use all libraries that are already installed. I am coding in C using gcc.

How to get a list of all those libraries ?

Babajaga
  • 77
  • 1
  • 3
  • 8

3 Answers3

3

For those libraries managed by the pkg-config utility, the following command will show all installed libraries:

pkg-config --list-all | less

However, not all libraries are so managed so you may be forced to go through the /usr/lib and /usr/local/lib directories.

Ken Keenan
  • 9,818
  • 5
  • 32
  • 49
2

As noted, not all libraries necessarily use pkg-config. Given that this is ArchLinux, as a fallback you could learn to use the package manager, to list the installed packages. That is called pacman.

Anything that is installed as such on ArchLinux would be part of a package.

The query options can show you all of the files installed for given packages:

  • To list all files for a given package, use pacman -Qlpackage_name
  • To list all packages, use pacman -Q

(scripting that, to list all ".so" files which are installed, by package name would be an interesting exercise).

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Life can be made much easier with a few helpful aliases in `.bashrc` as well. (e.g. `alias pmq='pacman -Q'`; `alias pmql='pacman -Ql'`, etc...) – David C. Rankin Sep 30 '15 at 03:27
  • Aliases are helpful to some people; I write far more scripts than aliases due to the way my environment works. – Thomas Dickey Sep 30 '15 at 08:04
1
ls /lib /usr/lib /usr/local/lib
Joshua
  • 40,822
  • 8
  • 72
  • 132