How to check open file without lsof

On linux, I use lsof to verify that the file is opened by which process. I have an Android device but no lsof command. Can I find which process to open a particular file?

I will use it to verify that MediaPlayer contains fd, but it should be closed.

+7
source share
3 answers

Install busybox, it has lsof command.

+1
source

Lsof poor man must fulfill

ls -l /proc/[process id]/fd 

However, you need to be root.

+11
source

Thanks to Mike Jones and Jock for advice with the poor man. I used it in the following busybox (synology nas) section to list the fd directories grouped by each process:

  for p in [0-9]*; do ls -l /proc/$p/fd ;done 
0
source

All Articles