Is their any specific command or tool to get the count of open files by a user in linux?
Asked
Active
Viewed 8.7k times
2 Answers
25
lsof -u username will return all the open files for the user. If you pass the result to wc command you will have the count you need. So, if the username of the user is test
lsof -u test | wc -l
dkokmadis
- 624
3
you can use lsof. this command is for find out what processes currently have the file open. if process opening the file, writing to it, and then closing it you can use auditing.
/sbin/auditctl -w /etc/myprogram/cofig.ini -p war -k config.ini-file
-w watch etc/myprogram/cofig.ini -p warx watch for write, attribute change, execute or read events -k config.ini-file is a search key. wait till the file change then use
/sbin/ausearch -f /etc/myprogram/cofig.ini | more
omid abbasi
- 131