My new best friend: strace

Siddhesh Poyarekar siddhesh.poyarekar at gmail.com
Wed May 19 05:27:34 UTC 2010


On Wed, May 19, 2010 at 2:44 AM, William Cohen <wcohen at redhat.com> wrote:
>
> If you want to see what shared libraries are being used by a process at the moment you could do something like the following (replacing 3250 with the appropriate prcess number):
>
> cat /proc/3250/task/*/maps |sort |uniq |awk '{print $6}'|sort |uniq

Or use lsof, which is way easier:

lsof | grep ^"$APP" | grep "\.so[.0-9]*$"

or

lsof | grep " $PID " | grep "\.so[.0-9]*$"

> You might be interested in the LD_DEBUG environment variable:
>
> LD_DEBUG=unused name_of_command_to_run
>
> You can get a list of available options with:
>
> LD_DEBUG=help /bin/false
>

I didn't know this; very neat stuff.


-- 
Siddhesh Poyarekar
http://siddhesh.in


More information about the users mailing list