{"id":78,"date":"2019-10-03T13:30:21","date_gmt":"2019-10-03T12:30:21","guid":{"rendered":"http:\/\/www.qpcoaching.co.uk\/qedevelopment.co.uk\/?p=78"},"modified":"2020-12-30T15:14:44","modified_gmt":"2020-12-30T15:14:44","slug":"linux-commands-wc","status":"publish","type":"post","link":"https:\/\/qedevelopment.co.uk\/?p=78","title":{"rendered":"Linux Commands: How to use wc"},"content":{"rendered":"\n<p>The wc command is used to count newlines, words, or bytes in a given file. Used with a pipe it can also be untilised for general counting operations. The following sections give a few examples of how it can be used.<\/p>\n\n\n\n<p>To count the number of bytes in a file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cat 02-Test.m3u | wc -c<\/pre>\n\n\n\n<p>To find the length of the longest line in a file. NB calling wc with the name of a file supplied results in output which contains both the answer and the file name., whilst piping to wc results only in the answer.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ wc -L 02-Test.m3u\n71 02-Test.m3u\n\n$ cat 02-Test.m3u | wc -L\n71<\/pre>\n\n\n\n<p>To count the number of files plus directories at the current location<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ls -1 | wc -l<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The wc command is used to count newlines, words, or bytes in a given file. Used with a pipe it can also be untilised for general counting operations. The following sections give a few examples of how it can be used. To count the number of bytes in a file: $ cat 02-Test.m3u | wc &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/qedevelopment.co.uk\/?p=78\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux Commands: How to use wc&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[11],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/78"}],"collection":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":7,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":367,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/367"}],"wp:attachment":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}