{"id":320,"date":"2020-05-21T05:16:00","date_gmt":"2020-05-21T05:16:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=320"},"modified":"2020-12-17T05:17:42","modified_gmt":"2020-12-17T05:17:42","slug":"recursively-counting-lines-in-files-in-a-directory-in-linux","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/recursively-counting-lines-in-files-in-a-directory-in-linux\/","title":{"rendered":"Recursively counting lines in files in a directory in Linux"},"content":{"rendered":"\n<p>To count lines of code in file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wc -l filename\n<\/code><\/pre>\n\n\n\n<p>To count lines in all php files in a directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wc -l *.php\n<\/code><\/pre>\n\n\n\n<p>This command counts lines in all php files in a directory but ignore its subdirectories. To include subdirectories, use the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find . -name '*.php' | xargs wc -l<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To count lines of code in file: To count lines in all php files in a directory This command counts lines in all php files in a directory but ignore its subdirectories. To include subdirectories, use the following command<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[35],"class_list":["post-320","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/320\/revisions\/321"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}