{"id":12454,"date":"2019-03-27T01:41:34","date_gmt":"2019-03-27T01:41:34","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12454"},"modified":"2019-03-27T01:41:34","modified_gmt":"2019-03-27T01:41:34","slug":"easily-correct-a-typo-of-previous-command-using-carat-symbol","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/27\/easily-correct-a-typo-of-previous-command-using-carat-symbol\/","title":{"rendered":"Easily Correct a Typo of Previous Command Using Carat (^) Symbol"},"content":{"rendered":"<p>Have you ever typed a command and rushed to hit\u00a0<strong>Enter<\/strong>, only to find that you had a typo in it? While you can use the\u00a0<code>up<\/code>\u00a0and\u00a0<code>down<\/code>\u00a0arrows to navigate the\u00a0<a href=\"https:\/\/www.tecmint.com\/history-command-examples\/\" target=\"_blank\" rel=\"noopener\">command history<\/a>\u00a0and edit the typo, there\u2019s an easier and faster way.<\/p>\n<p><b>Don\u2019t Miss:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/history-command-examples\/\" target=\"_blank\" rel=\"noopener\">The Power of Linux \u201cHistory Command\u201d in Bash Shell<\/a><\/p>\n<p>In this tip, we shall cover a simple and handy method of dealing with a command line typo, let\u2019s suppose you wanted to see if there\u2019s a service listening on port\u00a0<strong>22<\/strong>, but accidentally typed\u00a0<code>nestat<\/code>\u00a0instead of\u00a0<code>netstat<\/code>.<\/p>\n<p>You can easily replace the typo with the correct command and execute it like so:<\/p>\n<pre># nestat -npltu | grep 22\r\n# ^nestat^netstat\r\n<\/pre>\n<p>That\u2019s right. Using two\u00a0<strong>carat<\/strong>\u00a0signs (they should be followed by the typo and the right word, respectively) you can correct the typo and run the command automatically afterwards.<\/p>\n<div id=\"attachment_22052\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/08\/Correct-Fix-Command-Typos.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-22052\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/08\/Correct-Fix-Command-Typos.png\" sizes=\"auto, (max-width: 807px) 100vw, 807px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/08\/Correct-Fix-Command-Typos.png 807w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/08\/Correct-Fix-Command-Typos-768x182.png 768w\" alt=\"Correct Command Typos or Mistakes with Carat (^) Symbol\" width=\"807\" height=\"191\" aria-describedby=\"caption-attachment-22052\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-22052\" class=\"wp-caption-text\">Correct Command Typos or Mistakes with Carat (^) Symbol<\/p>\n<p>You must take note that this method only works for the previous command (most recent command executed), when you try to correct a typo for a command executed earlier on, the shell will print out an error.<\/p>\n<h3>Summary<\/h3>\n<p>This is a great tip that can help you eliminate time wasting tendencies, as you have seen, it is much easier and faster than scrolling through commands history to locate and correct a typo.<\/p>\n<p>All you have to do is correct the typo using the\u00a0<strong>carat<\/strong>\u00a0signs, hit\u00a0<strong>Enter<\/strong>\u00a0button and the correct command is executed automatically.<\/p>\n<p><a style=\"font-size: 1rem;\" href=\"https:\/\/www.tecmint.com\/fix-correct-mistakes-typos-previous-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever typed a command and rushed to hit\u00a0Enter, only to find that you had a typo in it? While you can use the\u00a0up\u00a0and\u00a0down\u00a0arrows to navigate the\u00a0command history\u00a0and edit the typo, there\u2019s an easier and faster way. Don\u2019t Miss:\u00a0The Power of Linux \u201cHistory Command\u201d in Bash Shell In this tip, we shall cover a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/27\/easily-correct-a-typo-of-previous-command-using-carat-symbol\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Easily Correct a Typo of Previous Command Using Carat (^) Symbol&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12454","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12454"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12454\/revisions"}],"predecessor-version":[{"id":12455,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12454\/revisions\/12455"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}