How do I close all open files in Linux?

Bờm

Member
How do I close all open files in Linux?
Answer
If you want to find only close the open file descriptors, you can
use the proc filesystem on systems where it exists
. E.g. on Linux, /proc/self/fd will list all open file descriptors. Iterate over that directory, and close everything >2, excluding the file descriptor that denotes the directory you are iterating over.
 

Tìm kiếm

Back
Top