AndreaNobili
AndreaNobili

Reputation: 42967

What do this ldconfig statment into this bash script?

I am pretty new in Linux and I have some doubt related to this operation that I have found into a bash script on which I am working:

ldconfig -v >> /dev/null 2>&1

Reading on the man page of the ldconfig command I can read:

ldconfig creates, updates, and removes the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib).

What exactly mean? I am using Ubuntu system and in /etc/ld.so.conf I found:

 include /etc/ld.so.conf.d/*.conf

So I think that this line redirect me to all the .conf files into /etc/ld.so.conf.d/ directory

But I have some confusion...and many doubts:

1) What are contains into the .conf file?

2) what exactly do the command that is in my bash script?

Tnx

Andrea

Upvotes: 0

Views: 2581

Answers (2)

umläute
umläute

Reputation: 31284

1) What are contains into the .conf file?

ldconfig uses configuration scripts (which can be stacked using the include directive) to know which directories it should search for libraries.

from man ldconfig:

/etc/ld.so.conf     File containing a list of colon, space, tab, newline, or
                    comma-separated directories in which to search for libraries.

2) what exactly do the command that is in my bash script?

it updates the dynamic linker cache. that is: if you are installing shared libraries it will make the newly installed libraries availabled to your system. (e.g. when installing libfoo.so.2.1 it will create the necessary symlinks to libfoo.so.2)

Upvotes: 2

anubhava
anubhava

Reputation: 785246

ldconfig -v >> /dev/null 2>&1 means redirect stdout (standard output) and stderr (standard error) to a special device /dev/null which means no-where (to discard it).

  • > /dev/null - is redirecting stdout
  • 2 > &1 is redirecting stderr to wherever stdout is redirected at since 1 is file descriptor of stdout and 2 is file descriptor of stderr

About ldconfig: ldconfig man page

As per manual:

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line

Upvotes: 2

Related Questions