Linux commands: Difference between revisions

Jump to navigation Jump to search
350 bytes added ,  1 December 2017
m
Line 30: Line 30:
newline count (count the number of lines of a file), word count
newline count (count the number of lines of a file), word count
* {{kbd | key= <nowiki>wc -l <filename></nowiki>}} for {{Linux}} <ref>[https://en.wikipedia.org/wiki/Wc_(Unix) wc (Unix) - Wikipedia, the free encyclopedia]</ref> ex: {{kbd | key= <nowiki>wc -l *.txt</nowiki>}} to print the newline count of txt files of the current folder  
* {{kbd | key= <nowiki>wc -l <filename></nowiki>}} for {{Linux}} <ref>[https://en.wikipedia.org/wiki/Wc_(Unix) wc (Unix) - Wikipedia, the free encyclopedia]</ref> ex: {{kbd | key= <nowiki>wc -l *.txt</nowiki>}} to print the newline count of txt files of the current folder  
* {{kbd | key= <nowiki>find . -type f -exec cat {} + | wc -l</nowiki>}} for {{Linux}} & {{Mac}} to print the newline count of all files on all subdirectories<ref>[https://stackoverflow.com/questions/13727917/use-wc-on-all-subdirectories-to-count-the-sum-of-lines linux - Use wc on all subdirectories to count the sum of lines - Stack Overflow]</ref>
* {{kbd | key= <nowiki>wc -l "$(cygpath -u '<path to file>')"</nowiki>}} for cygwin on {{Win}} ex: {{kbd | key= <nowiki>wc -l "$(cygpath -u 'c:\Program Files\file.txt')"</nowiki>}}<ref>[[Cygwin convert windows path to linux path]]</ref>
* {{kbd | key= <nowiki>wc -l "$(cygpath -u '<path to file>')"</nowiki>}} for cygwin on {{Win}} ex: {{kbd | key= <nowiki>wc -l "$(cygpath -u 'c:\Program Files\file.txt')"</nowiki>}}<ref>[[Cygwin convert windows path to linux path]]</ref>


Navigation menu