{"id":60493,"date":"2020-09-24T15:05:33","date_gmt":"2020-09-24T19:05:33","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=60493"},"modified":"2021-08-16T15:33:18","modified_gmt":"2021-08-16T19:33:18","slug":"how-to-review-bash-history","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/","title":{"rendered":"How to Review Bash History"},"content":{"rendered":"\n<p>When working in a Linux command-line interface (CLI), you may find yourself wondering exactly what commands you ran during the course of your workflow. Fortunately, <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/understanding-linux-operating-systems\/\">most Linux operating systems<\/a> store your commands in a bash history file, which is a stored list of all commands a given user has entered into the system. By reviewing this list, users can troubleshoot input errors or mistakes made while performing command-line operations. In this article, we will explore how to review bash histories and discuss the importance of the information contained within.<\/p>\n\n\n\n<p>Topics Include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#what\">What is Bash History?<\/a>&nbsp;<\/li><li><a href=\"#review\">Reviewing Bash History<\/a><\/li><\/ul>\n\n\n\n<p class=\"alert alert-info\">Learn how to review bash history to take more direct control over your <a href=\"https:\/\/www.inmotionhosting.com\/dedicated-servers\">Dedicated Hosting<\/a> server!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what\"><strong>What is Bash History?<\/strong><\/h2>\n\n\n\n<p>Bash history is simply the history of commands issued in bash. Bash is an abbreviation of \u201cBourne Again Shell\u201d, a type of user-interface or shell that allows users to directly interact with computer operating systems. This specific type of shell was developed for Unix systems and is still in use today on most modern Linux operating systems. A command run in bash is generally referred to as a bash command. Each of these commands are stored in the bash history, which can be reviewed in a list format using a simple Linux command. In the next section, we will discuss how to review this information.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"review\"><strong>Reviewing Bash History<\/strong><\/h2>\n\n\n\n<p>To review your bash history, you can use the the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">history<\/pre>\n\n\n\n<p>This should output a numbered list of all past commands entered into the system, in chronological order. If you wish to expand the amount of commands stored in the bash history, you can do so by modifying the <code>.bashrc<\/code> file. This file dictates how a given user\u2019s bash profile operates, including how bash history is stored. In this file, bash history is stored based on two parameters.&nbsp;<\/p>\n\n\n\n<p>The first parameter is <code>HISTFILESIZE<\/code>, which dictates how many commands are stored in the history file in total. The second parameter, <code>HISTSIZE<\/code>, dictates how many commands are stored in a given session. By increasing these values in the <code>.bashrc<\/code> file, you can increase the number of commands stored in the bash history.&nbsp;<\/p>\n\n\n\n<p>Now that you have a list of previously-issued commands, you can call them using the number assigned in the history. For example, if I wanted to rerun the command listed in the history as entry 46, I could call that command as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">!46<\/pre>\n\n\n\n<p>This will run the command that is associated with the 46th entry on the bash history list. By calling commands in this way, users can streamline repetitive command-line operations.&nbsp;<\/p>\n\n\n\n<p>By default, bash history is stored at the end of a bash session. In the event of multiple concurrent sessions, the bash histories may end up overwriting each other, with the last connected session being the only history that is saved. To get around this, we can set the bash histories to append, instead of overwrite. This can be done using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">shopt -s histappend<\/pre>\n\n\n\n<p>If done correctly, bash histories should be appended to the file for all sessions, even in the event of concurrent bash sessions.&nbsp;<\/p>\n\n\n\n<p>If you wish to clear the bash history for security reasons, you can do so with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">history -c&nbsp;<\/pre>\n\n\n\n<p>This will clear all commands from your bash history permanently. Please be aware that deleted histories cannot be recovered.&nbsp;<br><br>As you can see from these examples, reviewing bash histories can be done with a handful of simple commands. These characteristics make bash histories a vital part of any Linux workflow or troubleshooting operations. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working in a Linux command-line interface (CLI), you may find yourself wondering exactly what commands you ran during the course of your workflow. Fortunately, most Linux operating systems store your commands in a bash history file, which is a stored list of all commands a given user has entered into the system. By reviewing<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4308],"tags":[],"class_list":["post-60493","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>How to Review Bash History<\/title>\n<meta name=\"description\" content=\"In this article, we will discuss the importance of bash histories and explore how you can review your bash history for workflow and troubleshooting.\" \/>\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\/how-to-review-bash-history\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Review Bash History\" \/>\n<meta property=\"og:description\" content=\"In this article, we will discuss the importance of bash histories and explore how you can review your bash history for workflow and troubleshooting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\" \/>\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=\"2020-09-24T19:05:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-16T19:33:18+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\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\/how-to-review-bash-history\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"How to Review Bash History\",\"datePublished\":\"2020-09-24T19:05:33+00:00\",\"dateModified\":\"2021-08-16T19:33:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\"},\"wordCount\":594,\"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\/how-to-review-bash-history\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\",\"name\":\"How to Review Bash History\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2020-09-24T19:05:33+00:00\",\"dateModified\":\"2021-08-16T19:33:18+00:00\",\"description\":\"In this article, we will discuss the importance of bash histories and explore how you can review your bash history for workflow and troubleshooting.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Review Bash History\"}]},{\"@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\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Review Bash History","description":"In this article, we will discuss the importance of bash histories and explore how you can review your bash history for workflow and troubleshooting.","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\/how-to-review-bash-history\/","og_locale":"en_US","og_type":"article","og_title":"How to Review Bash History","og_description":"In this article, we will discuss the importance of bash histories and explore how you can review your bash history for workflow and troubleshooting.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2020-09-24T19:05:33+00:00","article_modified_time":"2021-08-16T19:33:18+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"How to Review Bash History","datePublished":"2020-09-24T19:05:33+00:00","dateModified":"2021-08-16T19:33:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/"},"wordCount":594,"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\/how-to-review-bash-history\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/","name":"How to Review Bash History","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2020-09-24T19:05:33+00:00","dateModified":"2021-08-16T19:33:18+00:00","description":"In this article, we will discuss the importance of bash histories and explore how you can review your bash history for workflow and troubleshooting.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-review-bash-history\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Review Bash History"}]},{"@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\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/60493","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\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=60493"}],"version-history":[{"count":6,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/60493\/revisions"}],"predecessor-version":[{"id":82787,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/60493\/revisions\/82787"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=60493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=60493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=60493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}