{"id":3276,"date":"2014-06-04T19:46:05","date_gmt":"2014-06-04T19:46:05","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2014\/06\/04\/cat-command\/"},"modified":"2022-03-31T19:38:11","modified_gmt":"2022-03-31T23:38:11","slug":"cat-command","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/","title":{"rendered":"cat command"},"content":{"rendered":"<style>   .directory{   color:#0066ff;   } <\/style>\n<p>When using <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-login-ssh\/\">SSH<\/a> to work on your site, you will often use the <strong>cat<\/strong> command. It is used to display file content on the screen. It is one of the most commonly used <a href=\"\/support\/server\/ssh\/command-list\/\">Linux commands<\/a> to assist in troubleshooting.<\/p>\n<p><strong>Command: <\/strong>cat<br \/>\n<strong>Synopsis: <\/strong>cat [OPTION] [FILE]&#8230;<\/p>\n<p><strong>Options: <\/strong><br \/>\nBelow are the different options that are available to customize the <strong>cat<\/strong> command.<\/p>\n<table class=\"article_table\">\n<tbody>\n<tr>\n<th>Option<\/th>\n<th>Long Name<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>-A<\/td>\n<td>&#8211;show-all<\/td>\n<td>Equivalent to running the v, E, and T options at the same time (-vET).<\/td>\n<\/tr>\n<tr>\n<td>-b<\/td>\n<td>&#8211;number-nonblank<\/td>\n<td>number nonblank output lines<\/td>\n<\/tr>\n<tr>\n<td>-e<\/td>\n<td><\/td>\n<td>equivalent to running the v and E options together (-vE).<\/td>\n<\/tr>\n<tr>\n<td>-E<\/td>\n<td>&#8211;show-ends<\/td>\n<td>displays $ at the end of each line.<\/td>\n<\/tr>\n<tr>\n<td>-n<\/td>\n<td>&#8211;number<\/td>\n<td>number all output lines<\/td>\n<\/tr>\n<tr>\n<td>-s<\/td>\n<td>&#8211;squeeze-blank<\/td>\n<td>Show no more than a single blank line in a row.<\/td>\n<\/tr>\n<tr>\n<td>-t<\/td>\n<td><\/td>\n<td>equivalent to using v and T options together (-vT).<\/td>\n<\/tr>\n<tr>\n<td>-T<\/td>\n<td>&#8211;show-tabs<\/td>\n<td>display TAB characters as ^I<\/td>\n<\/tr>\n<tr>\n<td>-v<\/td>\n<td>&#8211;show-nonprinting<\/td>\n<td>use ^ and M- notation, except for LFD and TAB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Examples<\/h2>\n<h3>Using the base cat command<\/h3>\n<p>This example uses the base <strong>cat<\/strong> command on a file named test.txt. It displays as it is configured in the file. Note that there are two blank lines after the first sentence.<\/p>\n<pre class=\"cli\">$# <span style=\"color:red\">cat test.txt<\/span> Lorem ipsum dolor sit amet, consectetur adipiscing elit.   In convallis leo nec lectus accumsan, id vehicula dui tincidunt. Proin eget pellentesque lectus. Duis id mauris vel massa imperdiet egestas sit amet eget ante. Nulla at fermentum turpis.  Morbi eu dictum felis. Morbi vel ipsum nunc. Nunc ac sapien viverra, dignissim arcu vitae, gravida magna. Phasellus a adipiscing sapien. Cras vel aliquet massa. Mauris quis auctor eros. Ut gravida tellus at nisi facilisis, adipiscing cursus nisi luctus.<\/pre>\n<h3>Removing extra blank lines<\/h3>\n<p>Using the squeeze (<em>-s<\/em>)  option you see that there is only a single blank line displayed after the first sentence.<\/p>\n<pre class=\"cli\">$# <span style=\"color:red\">cat -s test.txt<\/span> Lorem ipsum dolor sit amet, consectetur adipiscing elit.  In convallis leo nec lectus accumsan, id vehicula dui tincidunt. Proin eget pellentesque lectus. Duis id mauris vel massa imperdiet egestas sit amet eget ante. Nulla at fermentum turpis.  Morbi eu dictum felis. Morbi vel ipsum nunc. Nunc ac sapien viverra, dignissim arcu vitae, gravida magna. Phasellus a adipiscing sapien. Cras vel aliquet massa. Mauris quis auctor eros. Ut gravida tellus at nisi facilisis, adipiscing cursus nisi luctus.<\/pre>\n<h3>View line numbers<\/h3>\n<p>If you wish to view the line numbers for the file, simply add the <em>-n<\/em> option.<\/p>\n<pre class=\"cli\">$# <span style=\"color:red\">cat -n test.txt<\/span>      1  Lorem ipsum dolor sit amet, consectetur adipiscing elit.      2      3      4  In convallis leo nec lectus accumsan, id vehicula dui tincidunt. Proin eget pellentesque lectus. Duis id mauris vel massa      5  imperdiet egestas sit amet eget ante. Nulla at fermentum turpis.      6      7  Morbi eu dictum felis. Morbi vel ipsum nunc. Nunc ac sapien viverra, dignissim arcu vitae, gravida magna. Phasellus a      8  adipiscing sapien. Cras vel aliquet massa. Mauris quis auctor eros. Ut gravida tellus at nisi facilisis, adipiscing cursus nisi luctus.<\/pre>\n<h3>Using multiple options<\/h3>\n<p>You can always place options together. In this example, we use the <em>-s<\/em> and the <em>-n<\/em> options together. This displays the line numbers as well as removing any extraneous blank lines.<\/p>\n<pre class=\"cli\">$# <span style=\"color:red\">cat -ns test.txt<\/span>      1  Lorem ipsum dolor sit amet, consectetur adipiscing elit.      2      3  In convallis leo nec lectus accumsan, id vehicula dui tincidunt. Proin eget pellentesque lectus. Duis id mauris vel massa      4  imperdiet egestas sit amet eget ante. Nulla at fermentum turpis.      5      6  Morbi eu dictum felis. Morbi vel ipsum nunc. Nunc ac sapien viverra, dignissim arcu vitae, gravida magna. Phasellus a      7  adipiscing sapien. Cras vel aliquet massa. Mauris quis auctor eros. Ut gravida tellus at nisi facilisis, adipiscing cursus nisi luctus.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When using SSH to work on your site, you will often use the cat command. It is used to display file content on the screen. It is one of the most commonly used Linux commands to assist in troubleshooting. Command: cat Synopsis: cat [OPTION] [FILE]&#8230; Options: Below are the different options that are available to<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\"> Read More ><\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4308],"tags":[],"class_list":["post-3276","post","type-post","status-publish","format-standard","hentry","category-linux"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>cat command | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to use the cat Linux command and all its options.\" \/>\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.inmotionhosting.com\/support\/server\/linux\/cat-command\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"cat command | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to use the cat Linux command and all its options.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-04T19:46:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-31T23:38:11+00:00\" \/>\n<meta name=\"author\" content=\"Scott Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Scott Mitchell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\"},\"author\":{\"name\":\"Scott Mitchell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\"},\"headline\":\"cat command\",\"datePublished\":\"2014-06-04T19:46:05+00:00\",\"dateModified\":\"2022-03-31T23:38:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\"},\"wordCount\":270,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\",\"name\":\"cat command | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2014-06-04T19:46:05+00:00\",\"dateModified\":\"2022-03-31T23:38:11+00:00\",\"description\":\"Learn how to use the cat Linux command and all its options.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"cat command\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\",\"name\":\"Scott Mitchell\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"cat command | InMotion Hosting","description":"Learn how to use the cat Linux command and all its options.","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.inmotionhosting.com\/support\/server\/linux\/cat-command\/","og_locale":"en_US","og_type":"article","og_title":"cat command | InMotion Hosting","og_description":"Learn how to use the cat Linux command and all its options.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2014-06-04T19:46:05+00:00","article_modified_time":"2022-03-31T23:38:11+00:00","author":"Scott Mitchell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Scott Mitchell","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/"},"author":{"name":"Scott Mitchell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed"},"headline":"cat command","datePublished":"2014-06-04T19:46:05+00:00","dateModified":"2022-03-31T23:38:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/"},"wordCount":270,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/","name":"cat command | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2014-06-04T19:46:05+00:00","dateModified":"2022-03-31T23:38:11+00:00","description":"Learn how to use the cat Linux command and all its options.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/cat-command\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"cat command"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed","name":"Scott Mitchell","url":"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3276"}],"version-history":[{"count":2,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3276\/revisions"}],"predecessor-version":[{"id":95559,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3276\/revisions\/95559"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}