Is there a way to view or get a list of executables that a program uses?

A particular example is file-roller. Is there a way to see which executables it uses, if there is more than one executable it could use for the same task, e.g. unrar and p7zip-rar.

The program 'ldd' can be used to view the libraries a programs uses, though not in real-time. Is there an equivalent for executables, preferably in real-time? Or some other method?

  • 1
    Using strace <cmd> and ps are the best 2 ways.
    – slm
    May 24, 2014 at 18:20

2 Answers 2


Try starting with strace. When one program calls another, it uses one of the exec system calls. For instance, given the following ruby script:

#!/usr/bin/env ruby

I can grep strace output to find out what executables it runs:

$ strace -f ./test.rb  2>&1 | grep exec
execve("./test.rb", ["./test.rb"], [/* 23 vars */]) = 0
execve("/opt/opscode/embedded/bin/ruby", ["ruby", "./test.rb"], [/* 23 vars */]) = 0
[pid  7696] read(5, "ame+.  If the +exec_name+\n  # is"..., 8192) = 8192
[pid  7698] execve("/bin/ls", ["ls"], [/* 23 vars */] <unfinished ...>
[pid  7698] <... execve resumed> )      = 0
[pid  7700] execve("/bin/df", ["df"], [/* 23 vars */] <unfinished ...>
[pid  7700] <... execve resumed> )      = 0

The -f ensures that strace also traces child processes. At the beginning you can see the shell executing my script and the ruby interpreter. Then we can see that this script also executes /bin/ls and /bin/df. Note that this method will only show you the executables are used at run time, not all executables that might have been used if your runtime state had been different.

  • 1
    Alternatively, strace -e trace=process makes strace only print out the process-related system calls, so the grep might then be unnecessary. (I think you can also use strace -e trace=execve to print out only calls to execve() exactly, and similarly for other system calls.)
    – David Z
    May 24, 2014 at 23:42

An easy method is to use top.

To determine whether file-roller is using either unrar or p7zip-rar, simply start top in a terminal, then extract a big rar file using file-roller.

While the rar file is being extracted, look at the terminal. If unrar is being used, the top process will be unrar; if p7zip-rar is being used, the top process will be 7z.

  • top will be very unwieldy, especially if the secondary processes don't top whatever sorting metric is being used.
    – muru
    Dec 28, 2014 at 18:29
  • @muru: It works perfectly on my system. Archive extraction always uses the most CPU cycles (the default sorting metric), so the process responsible will always be at the top of the list. And even if it weren't at the top, how hard is it to look in the process list for either unrar or 7z?
    – EmmaV
    Dec 28, 2014 at 18:43
  • That's for one particular example. If I give you a random program, can you be certain this will work as well? And the whole point is to discover which programs are run. If I already know it runs 7z or unrar, what's the point?
    – muru
    Dec 28, 2014 at 18:45
  • @muru: The point is to determine whether file-roller uses p7zip-rar or unrar, as in the asker's specific example.
    – EmmaV
    Dec 28, 2014 at 18:49
  • Yes, it is a specific example, provided for the sake of an example. That doesn't mean the question is entirely about file-roller.
    – muru
    Dec 28, 2014 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.