Dealing with Open Files
How many files are currently open?
- Use the
lsof
(list open files) command to print a list of all open files. Highly useful tool; very flexible parameters. Similar in scope tofind
command, but for processes. List can be sorted/filtered as needed.
How many files are open by a certain user?
Detail:
ps ux | grep userID
or Summary:
ps ux | grep userID | wc -l
How many files are open by a certain program?
lsof | grep processId | wc -l
or
lsof | grep processName | wc -l
How many files can I open with my User ID?
At a command prompt, type:
ulimit -n
How can I increase the number of files I can open with my User ID?
At a command prompt, type:
ulimit -n 4096
What about the system open file limit?
cat /proc/sys/fs/file-max