{"id":202,"date":"2016-01-12T15:33:59","date_gmt":"2016-01-12T15:33:59","guid":{"rendered":"http:\/\/wp-p3d2tsa2xh.pairsite.com\/?p=202"},"modified":"2019-02-06T13:37:37","modified_gmt":"2019-02-06T18:37:37","slug":"paircloud-viewing-files-with-cat-and-more","status":"publish","type":"ht_kb","link":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/","title":{"rendered":"Viewing Files with cat and more"},"content":{"rendered":"<p class=\"p1\"><span class=\"s1\"><a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/shared-hosting\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">Shared<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/vps\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">VPS<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/qs-dedicated\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px; font-weight:bold; border-radius:3px;\">Dedicated<\/p><\/a>\u00a0<a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional-plus\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional Plus<\/p><\/a><\/span><\/p>\n<p><code>less<\/code>, <code>more<\/code> and <code>cat<\/code> are all file viewers but each has their own particular uses.<\/p>\n<p><code>cat<\/code> simply prints the file to the standard output (your screen usually) in one big rush. If it is a simple file with say 10 or 20 lines this is the command to use. <code>more<\/code> allows you to do the same as <code>cat<\/code> except it pauses the scrolling every time a screen full has been displayed allowing you to use the space bar to get the next page. <code>less<\/code> does what <code>more<\/code> does but allows you to scroll backwards as well as paging forward.<\/p>\n<h3 class=\"kb\">cat<\/h3>\n<p><code>cat<\/code> is your first choice for viewing a file because it is fast and simple. It is also your best choice if you are piping the output to another command. There are options for this command such as <code>-b<\/code> <code>-n<\/code> and <code>-s<\/code>. To number all lines use <code>-n<\/code>, to number all lines except blank ones use <code>-b<\/code> and to skip blank lines use <code>-s<\/code>. You can combine these and for instance do <code>cat -sn<\/code><\/p>\n<h3 class=\"kb\">more<\/h3>\n<p>The <code>more<\/code> command is a bit more useful if you are wanting to page output to look for specific items. However in most cases <code>less<\/code> is probably more useful. In general you may use <code>more<\/code> for paging output from other commands especially ones that may contain encoding. If you are wanting to read a static text file then <code>less<\/code> is most suitable. To stop the output use CTRL+C<\/p>\n<h3>less<\/h3>\n<p><code>less<\/code> is your goto command for file viewing. The basic usage is <code>less filename<\/code>. You then use the f key to go down a page and the b key to go up a page. This is its main advantage over <code>more<\/code>, the ability to go back and forward. <code>less<\/code> also uses a lot of the same commands as <code>vim<\/code>. So for instance to go to line 100 you would type in <code>100G<\/code> where G means go. To quit <code>less<\/code> use the q key.<\/p>\n<p>The other most useful option of <code>less<\/code> is the R key. This refreshes the page, this is useful in cases where the file may be changing.<\/p>\n<p><code>less<\/code> can also be used instead of <code>tail -f logname.log<\/code>. To do this use <code>less +F logname.log<\/code>, you can then CTRL + C to go to editing mode to scroll back and forward.<\/p>\n<p>That is really the basics of using <code>less<\/code>. It has lots of features though and <code>man less<\/code> is worth a read in case there are any features that you would find useful in your particular use cases.<\/p>\n<h3 class=\"kb\">Which should I use and when?<\/h3>\n<p>The following are some general recommendations about which utility is useful when.<\/p>\n<p>If you are piping the output to another command then use <code>cat<\/code> in pretty much every case.<\/p>\n<p>If you are not dealing with a file or the output contains ANSI codes then it is generally better to use <code>more<\/code>. An example of this is if you want to list a directory's contents with color and then page it. <code>ls | more<\/code> and <code>ls to less<\/code> don\u2019t work. You need to use <code>ls<\/code> with the <code>--color=yes<\/code> option because when you pipe the output it strips it of the ANSI codes. If you try <code>ls --color=yes | more<\/code> and <code>ls --color=yes | less<\/code>, you will see that the more output is exactly what you needed whereas the <code>less<\/code> output has lots of strange characters and no color. You can fix this by using ls \u2013color=yes | less -R however it is much simpler to simply type in <code>| more<\/code> than <code>| less -R<\/code><\/p>\n<p>If you are simply wanting to read a static file that won\u2019t be changing then <code>less<\/code> is always your best choice.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 less, more and cat are all file viewers but each has their own particular uses. cat simply prints the file to the standard output (your screen usually) in one big rush. If it is a simple file with say 10 or 20 lines this is the command to use&#8230;.<\/p>\n","protected":false},"author":12,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":[],"ht-kb-category":[13],"ht-kb-tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Viewing Files with cat and more - Knowledge Base - Pair Networks<\/title>\n<meta name=\"description\" content=\"less, more and cat are all file viewers, but each has their own particular uses. Read on to learn more about each command&#039;s specific uses.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Viewing Files with cat and more - Knowledge Base - Pair Networks\" \/>\n<meta property=\"og:description\" content=\"less, more and cat are all file viewers, but each has their own particular uses. Read on to learn more about each command&#039;s specific uses.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - Pair Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pairnetworks\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-06T18:37:37+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@pairNetworks\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/\",\"name\":\"Viewing Files with cat and more - Knowledge Base - Pair Networks\",\"isPartOf\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\"},\"datePublished\":\"2016-01-12T15:33:59+00:00\",\"dateModified\":\"2019-02-06T18:37:37+00:00\",\"description\":\"less, more and cat are all file viewers, but each has their own particular uses. Read on to learn more about each command's specific uses.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pair.com\/support\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Viewing Files with cat and more\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"name\":\"Knowledge Base - Pair Networks\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\",\"name\":\"Pair Networks\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"contentUrl\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"width\":360,\"height\":360,\"caption\":\"Pair Networks\"},\"image\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pairnetworks\/\",\"https:\/\/twitter.com\/pairNetworks\",\"https:\/\/www.instagram.com\/pairnetworks\/\",\"https:\/\/www.linkedin.com\/company\/2269676\/\",\"https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/\",\"https:\/\/www.youtube.com\/user\/pairnetworks\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Viewing Files with cat and more - Knowledge Base - Pair Networks","description":"less, more and cat are all file viewers, but each has their own particular uses. Read on to learn more about each command's specific uses.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/","og_locale":"en_US","og_type":"article","og_title":"Viewing Files with cat and more - Knowledge Base - Pair Networks","og_description":"less, more and cat are all file viewers, but each has their own particular uses. Read on to learn more about each command's specific uses.","og_url":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/","og_site_name":"Knowledge Base - Pair Networks","article_publisher":"https:\/\/www.facebook.com\/pairnetworks\/","article_modified_time":"2019-02-06T18:37:37+00:00","twitter_card":"summary_large_image","twitter_site":"@pairNetworks","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/","url":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/","name":"Viewing Files with cat and more - Knowledge Base - Pair Networks","isPartOf":{"@id":"https:\/\/www.pair.com\/support\/kb\/#website"},"datePublished":"2016-01-12T15:33:59+00:00","dateModified":"2019-02-06T18:37:37+00:00","description":"less, more and cat are all file viewers, but each has their own particular uses. Read on to learn more about each command's specific uses.","breadcrumb":{"@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-viewing-files-with-cat-and-more\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pair.com\/support\/kb\/"},{"@type":"ListItem","position":2,"name":"Viewing Files with cat and more"}]},{"@type":"WebSite","@id":"https:\/\/www.pair.com\/support\/kb\/#website","url":"https:\/\/www.pair.com\/support\/kb\/","name":"Knowledge Base - Pair Networks","description":"","publisher":{"@id":"https:\/\/www.pair.com\/support\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pair.com\/support\/kb\/#organization","name":"Pair Networks","url":"https:\/\/www.pair.com\/support\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","contentUrl":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","width":360,"height":360,"caption":"Pair Networks"},"image":{"@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pairnetworks\/","https:\/\/twitter.com\/pairNetworks","https:\/\/www.instagram.com\/pairnetworks\/","https:\/\/www.linkedin.com\/company\/2269676\/","https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/","https:\/\/www.youtube.com\/user\/pairnetworks"]}]}},"_links":{"self":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/202"}],"collection":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":5,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/202\/revisions"}],"predecessor-version":[{"id":6561,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/202\/revisions\/6561"}],"wp:attachment":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=202"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}