Take the 2-minute tour ×

I've got a folder in linux, which is contained several shared object files (*.so). How I can find function in shared object files using objdump and bash functions in linux?

For instance, the following example is found me function func1 in mylib.so:

objdump -d mylib.so | grep func1

But i want to find func1 in folder which is contained shared object files. I don't know bash language and how to combinate linux terminal commands.

share|improve this question

2 Answers 2

up vote 12 down vote accepted

nm is simpler than objdump, for this task.
nm -A *.so | grep func should work. The -A flag tells nm to print the file name.

share|improve this answer
You need the -D option as well to actually look in the list of exported symbols. –  jørgensen Feb 20 '12 at 22:31
@jørgensen, it isn't clear from the question whether he wants an exported function. Maybe he wants to know what library he needs to rebuild after changing a function. –  ugoren Feb 21 '12 at 7:40

You can use also use,

find <path> -name "*.so" -exec nm {} \; | grep func1
share|improve this answer
grep func1 nm {}?? Do you mean nm {} | grep func1? –  ugoren Feb 20 '12 at 9:49
You would run nm | grep func1, the execution is from left to right if you are using it without exec. But with exec the execution is from right to left and {} specifies the input from the find command, so the above command means 'run the grep on the result of the nm for all the files from find'. –  Deepak Feb 20 '12 at 12:43
I tried your line - it just doesn't work. It just runs grep func1 nm xxx.so per file, which searches for func1 in a file called "nm" and in the binary (without running nm). –  ugoren Feb 20 '12 at 13:44
Yes, you are right. I did not notice that too closely last time. I have edited my answer. –  Deepak Feb 21 '12 at 9:33

Your Answer


