{"id":336,"date":"2010-07-22T14:35:16","date_gmt":"2010-07-22T21:35:16","guid":{"rendered":"http:\/\/ben.akrin.com\/?p=336"},"modified":"2010-07-22T14:35:16","modified_gmt":"2010-07-22T21:35:16","slug":"process-file-descriptor-count","status":"publish","type":"post","link":"https:\/\/ben.akrin.com\/?p=336","title":{"rendered":"process file descriptor count"},"content":{"rendered":"<p>I&#8217;ve recently had to deal with a process leaking file descriptors. The following command came in handy as a quick way to count how many file descriptors a process is using.<\/p>\n<p>Let&#8217;s say that we want to count them for the process(es) called firefox:<\/p>\n<p>[bash]ps -ae | grep firefox | perl -lane &#8216;print $F[0]&#8217; | while read filename; do ls \/proc\/$filename\/fd; done | wc -w[\/bash]<\/p>\n<p>TADAA!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve recently had to deal with a process leaking file descriptors. The following command came in handy as a quick way to count how many file descriptors a process is using. Let&#8217;s say that we want to count them for the process(es) called firefox: [bash]ps -ae | grep firefox | perl -lane &#8216;print $F[0]&#8217; | &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ben.akrin.com\/?p=336\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;process file descriptor count&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,18],"tags":[],"class_list":["post-336","post","type-post","status-publish","format-standard","hentry","category-i-t","category-unix-linux"],"_links":{"self":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/posts\/336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336"}],"version-history":[{"count":0,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/posts\/336\/revisions"}],"wp:attachment":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}