List shared libraries for running processes

Matthew Seaman matthew at freebsd.org
Tue Aug 13 07:32:34 UTC 2013


On 13/08/2013 07:44, Quark wrote:
> MS Windows has a command 'tasklist' which take /m switch
> 
> If I wanted to list all processes who have kernel32.dll loaded I had invoke
> 
> tasklist /m kernel32.dll
> 
> 
> Image Name                     PID Modules                                     
> ========================= ======== ============================================
> taskhost.exe                  1876 kernel32.dll                                
> dwm.exe                       1664 kernel32.dll                                
> explorer.exe                  1688 kernel32.dll                                
> hkcmd.exe                     2860 kernel32.dll                                
> igfxpers.exe                  2868 kernel32.dll                                
> TSVNCache.exe                 2124 kernel32.dll                                
> McUICnt.exe                   2100 kernel32.dll                                
> wuauclt.exe                   4520 kernel32.dll                                
> vmware-vmx.exe                3172 kernel32.dll                                
> gvim.exe                      5992 kernel32.dll                                
> cmd.exe                       3844 kernel32.dll                                
> conhost.exe                   4004 kernel32.dll                                
> tasklist.exe                  3184 kernel32.dll                                
> 
> see that is pretty nice, what is option on FreeBSD? it is OK to write some script if the need be
> don't want to consider lsof at the moment, if it can be achieved using fstat or something similar
> if not will give lsof a shot, I have slight dislike of non-core utils.

procstat -v pid

should give you a list of shared libraries used by the process with that
pid.

procstat -va

is the equivalent for every process on the system.

Turning that into a nicely formatted list for all processes as you show
for the Windows output above shouldn't be too hard for anyone with
reasonable shell skills.

	Cheers,

	Matthew



More information about the freebsd-ports mailing list