Show top of programms which are open file descriptors now, sorted by count DESC, grouped by process name and pid

sudo lsof | awk '{print $1,$2}' | sort | uniq -c | sort -nr
Show what the process are opening many many file descriptos now, we can analyze this for the reason why server is worked slowly.
Sample Output
  10592 mysqld 3169
    301 opendkim 2604
    145 fail2ban- 3175
    128 master 3693
    113 php5-fpm 6792
    112 php5-fpm 7825
    112 php5-fpm 5872
    111 php5-fpm 2313
     94 dklab_dae 15461
     93 icecast2 2289
     78 rsyslogd 2316
     72 nginx 2599
     67 nginx 2601
     67 nginx 2600
     63 nginx 2598
     62 nginx 2602
     48 sshd 8980
     44 sshd 8976
     40 tlsmgr 27868
     39 opendkim 2603
     36 squid3 3626
     33 qmgr 3714

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: