Announcement

Collapse
No announcement yet.

Learn which Libraries Programs Call

Collapse
X
Collapse
  •  

  • Learn which Libraries Programs Call

    Sometimes it comes in handy to know what libraries and what versions of those libraries some software is depending on.
    This is quite easy and is done with the "ldd" command.

    Here are the dependencies that the "ls" command has. Remark that you have to use the absolute path as ldd does not support the use of the search path stated in the environment variable PATH.

    # ldd /bin/ls
    linux-gate.so.1 => (0xb7fd4000)
    librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb7fb0000)
    libselinux.so.1 => /lib/libselinux.so.1 (0xb7f97000)
    libacl.so.1 => /lib/libacl.so.1 (0xb7f8f000)
    libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7e34000)
    libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7e1b000)
    /lib/ld-linux.so.2 (0xb7fd5000)
    libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7e17000)
    libattr.so.1 => /lib/libattr.so.1 (0xb7e12000)

    For version information you just add the "-v" option for verbose output. The output will be quite a bit longer but helps while debugging.

    # ldd -v /bin/ls
    linux-gate.so.1 => (0xb7fa7000)
    librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb7f83000)
    libselinux.so.1 => /lib/libselinux.so.1 (0xb7f6a000)
    libacl.so.1 => /lib/libacl.so.1 (0xb7f62000)
    libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7e07000)
    libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7dee000)
    /lib/ld-linux.so.2 (0xb7fa8000)
    libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7dea000)
    libattr.so.1 => /lib/libattr.so.1 (0xb7de5000)

    Version information:
    /bin/ls:
    librt.so.1 (GLIBC_2.2) => /lib/i686/cmov/librt.so.1
    libacl.so.1 (ACL_1.0) => /lib/libacl.so.1
    libc.so.6 (GLIBC_2.2.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6
    /lib/i686/cmov/librt.so.1:
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    libpthread.so.0 (GLIBC_2.1) => /lib/i686/cmov/libpthread.so.0
    libpthread.so.0 (GLIBC_2.2) => /lib/i686/cmov/libpthread.so.0
    libpthread.so.0 (GLIBC_PRIVATE) => /lib/i686/cmov/libpthread.so.0
    libpthread.so.0 (GLIBC_2.0) => /lib/i686/cmov/libpthread.so.0
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.3.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_PRIVATE) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6
    /lib/libselinux.so.1:
    ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
    libdl.so.2 (GLIBC_2.1) => /lib/i686/cmov/libdl.so.2
    libdl.so.2 (GLIBC_2.0) => /lib/i686/cmov/libdl.so.2
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.3.4) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6
    /lib/libacl.so.1:
    libattr.so.1 (ATTR_1.0) => /lib/libattr.so.1
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6
    /lib/i686/cmov/libc.so.6:
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
    /lib/i686/cmov/libpthread.so.0:
    ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.3.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_PRIVATE) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6
    /lib/i686/cmov/libdl.so.2:
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_PRIVATE) => /lib/i686/cmov/libc.so.6
    /lib/libattr.so.1:
    libc.so.6 (GLIBC_2.1.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2.3) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/i686/cmov/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/i686/cmov/libc.so.6

    The first part of the output is the same as without the verbose output but the extended part will show the needed versions of each library for ls to work properly.
    Ofcourse this is not as useful for the "ls" command but this will work with almost anything. Even your own software.
    Give it a try!
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    Latest Articles

    Collapse

    • Testing your Mail Server
      by Resheph
      Telnet to your smtp server using the following:
      "telnet example.com 25". The number "25" is the default portnumber for outging mail, defined by IANA.
      Substitute the address with your own address or ip number.
      Even though this might very well be possible to do on your ISP mail server, dont!!
      This will give you the SMTP server banner. I hope this has been changed or spoofed to protect from banner grabbing.
      In my example, it gives me "220 example.com...
      08-06-2016, 09:38 PM
    • Knowing your System Performance and State
      by Resheph
      Here are a few command line tools that will help you estimate your system usage and performance.
      There is a lot more information on this in the man pages so take a look there also. If you dont know your average system load you will not be able to determine if the load is in a peaking state or if the host is able to handle more load.
      Note that some commands might require installation of a few packages.

      Below gives a nice simple performance view of a HDU. Ofcourse running...
      08-06-2016, 09:35 PM
    • Browsing your Hardware in Linux
      by Resheph
      Sometimes it can be quite a challenge to find out what hardware you have but it is actually quite easy.
      Here are a few commands and some sample output for you.

      USB devices are usually easy to identify because you can just pick them up and look at them.
      Below will help you out with the few that just say NoName on it. Often those noname ones are the same as the named ones just with another wrapping. Below display a list of detected USB devices.

      # lsusb
      Bus...
      08-06-2016, 09:34 PM
    • Keeping an Eye on Logfiles
      by Resheph
      If you want to watch a log file and have it update when ever new content is added the "tail" command is an easy on-the-fly tool to use.
      Ofcourse for long term use other implementations of log file analyzers or syslog services would be better.
      Here is a short example and some sample output showing a failed root login attempt.

      # tail -n 20 -f -s 5 /var/log/auth.log
      Feb 17 04:11:09 testbox login[4822]: pam_unix(login:auth): authentication failure; logname=LOGIN...
      08-06-2016, 09:31 PM
    • Learn which Libraries Programs Call
      by Resheph
      Sometimes it comes in handy to know what libraries and what versions of those libraries some software is depending on.
      This is quite easy and is done with the "ldd" command.

      Here are the dependencies that the "ls" command has. Remark that you have to use the absolute path as ldd does not support the use of the search path stated in the environment variable PATH.

      # ldd /bin/ls
      linux-gate.so.1 => (0xb7fd4000)
      librt.so.1 => /lib/i686/cmov/librt.so.1...
      08-06-2016, 09:29 PM
    Working...
    X