Have you tried MySQLTuner yet? It's free and it makes optimizing your MySQL server easier than ever!

In the event that your system is running out of file descriptors, or you simply want to know what your users are doing, you can review their count of open files by running this command:

lsof | grep ' root ' | awk '{print $NF}' | sort | wc -l

Of course, if you want to drop the count and show the actual processes, you can run:

lsof | grep ' root '

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis
2 Responses to “Counting open files per user”

  1. lsof | grep ' root ' | awk '{print $NF}' | sort | wc -l

    I am not sure what the awk,sort, and wc commands are being used for. Did you mean?


    lsof | grep ' root ' | awk '{print $NF}' | sort -u | wc -l

    Also of use would be:


    lsof -u username

  2. “I am not sure what the awk,sort, and wc commands are being used for.”

    Sorry, I meant more just using -c on great or counting the lines directly.

Leave a Reply

You must be logged in to post a comment. Login »