

{"id":111936,"date":"2023-02-10T09:00:02","date_gmt":"2023-02-10T03:30:02","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=111936"},"modified":"2023-02-10T09:28:12","modified_gmt":"2023-02-10T03:58:12","slug":"history-command-in-linux","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/","title":{"rendered":"History Command in Linux"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In this article, we will learn everything about the history command in Linux. First, we will look at what the history command is, why it is used, and understand the output of the history command as we take a closer look at the fields in the output, the syntax of the history command, and the options used along with it.<\/span><\/p>\n<p><span style=\"font-weight: 400\">At the end, we will also look at examples of the history command by pairing it with various options to understand its working. So pay attention, take notes, and read all the way to the end for the best benefits.<\/span><\/p>\n<h3>What is Linux history command?<\/h3>\n<p>History is a command-line-based utility in Linux-based operating systems that lets you view the commands you executed previously in the terminal. This is extremely helpful to look at a set of actions you executed previously.<\/p>\n<p>Most of the commands in Linux read input from the terminal line at a time, but that is not the case with the history command. As a result, it is capable of keeping a record of those lines with associated data. In addition, it can also show the last 500 commands used by default.<\/p>\n<p>The history library is stored in a history file, showing the older to most recent commands used. This command was not initially available in the bourne shell, but today it is even available with the Bash and Korn shells. In the bash shell, the history command shows the whole list of commands.<\/p>\n<h3><strong>Syntax of the history command in Linux<\/strong><\/h3>\n<p>The syntax of the history command may look slightly intimidating initially. Still, when we look at the different fields present in the syntax and understand what they are for, it will become a cakewalk. The syntax of the history command is:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history &lt;options&gt; &lt;num&gt;<\/pre>\n<p>Let us look at the fields in the syntax of the history command:<\/p>\n<p><strong>1. &lt;options&gt;<\/strong><\/p>\n<p>This field takes in several options that specify how the history command must function, format, and print the output. You can even specify multiple options in this field.<\/p>\n<p><strong>2. &lt;num&gt;<\/strong><\/p>\n<p>As we discussed earlier, the history command shows the last 500 commands used by default. Nonetheless, we can specify the number of commands we want to see, and the history command will show only that much.<\/p>\n<h3>Options used with Linux history command<\/h3>\n<p>Unlike most of the commands in Linux, the head command has only a few options associated with it. Let us take a brief look at each one of them:<\/p>\n<p><strong>1. -c<\/strong><\/p>\n<p>This option clears the history list by deleting all of the entries.<\/p>\n<p><strong>2. -d<\/strong><\/p>\n<p>This option deletes the history entry at the offset you specified.<\/p>\n<p><strong>3. &#8211;help<\/strong><\/p>\n<p>This option displays the help menu of the history command, as shown below.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/help-menu-of-the-history-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111977\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/help-menu-of-the-history-command.webp\" alt=\"help menu of the history command\" width=\"1172\" height=\"449\" \/><\/a><\/p>\n<p><strong>4. -n<\/strong><\/p>\n<p>This option reads all the history lines not already read from the history file.<\/p>\n<p><strong>5. -r<\/strong><\/p>\n<p>This option reads the history file and appends the contents to the history list.<\/p>\n<p><strong>6. -w<\/strong><\/p>\n<p>This option writes the current history to the history file and appends them to the history list.<\/p>\n<p><strong>7. -a<\/strong><\/p>\n<p>This option appends history lines from this session to the history file.<\/p>\n<p><strong>8. -p<\/strong><\/p>\n<p>This option performs history expansion on each ARG and displays the result without storing it in the history list.<\/p>\n<p><strong>9. -s<\/strong><\/p>\n<p>This option appends the ARGs to the history list as a single entry.<\/p>\n<p>Now that we have covered the basics and the theoretical part of the history command, let us understand how the history command and its options work by looking at some practical examples of it in the terminal of Ubuntu 20.04.<\/p>\n<h3>Displaying the previously executed commands in the terminal<\/h3>\n<p>If you want to display the list of commands that you have executed previously in the terminal, use the history command without any options, as shown below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/displaying-the-previously-executed-commands-in-the-terminal.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111978\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/displaying-the-previously-executed-commands-in-the-terminal.webp\" alt=\"displaying the previously executed commands in the terminal\" width=\"1073\" height=\"613\" \/><\/a><\/p>\n<h3>Displaying the first n commands from the history file<\/h3>\n<p>In the output above, the history command prints many previously executed commands. However, we can specify the number of commands we want to see by executing the history command allowed by the number of commands you want to see as shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history &lt;number&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/displaying-the-first-n-commands-from-the-history-file.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111979\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/displaying-the-first-n-commands-from-the-history-file.webp\" alt=\"displaying the first n commands from the history file\" width=\"1073\" height=\"370\" \/><\/a><\/p>\n<h3><strong>Using date and timestamps<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">We can change and <\/span>modify the output format of the history command<span style=\"font-weight: 400\"> by tinkering with the \u201c.bashrc\u201d file. To open the \u201c.bashrc\u201d file, we make use of the following command<\/span>: \u201csudo nano .bashrc\u201d.\u00a0 <span style=\"font-weight: 400\">Add the line shown below in the file <\/span>to change the output format to include date and timestamps:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">export HISTTIMEFORMAT=\"%c \"<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/using-date-and-timestamps.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111980\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/using-date-and-timestamps.webp\" alt=\"using date and timestamps\" width=\"1172\" height=\"600\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Once you finish editing the file, press the key combination \u201cCtrl\u201d + \u201cx\u201d and then y to save your changes. We can also use several <\/span>arguments after HISTTIMEFORMAT to customize the level of detail in the timestamp.<span style=\"font-weight: 400\"> For example, we can specify the following arguments:<\/span><\/p>\n<p>1. %d: Day<br \/>\n2. %m: Month<br \/>\n3. %y: Year<br \/>\n4. %H: Hour<br \/>\n5. %M: Minutes<br \/>\n6. %S: Seconds<br \/>\n7. %F: Full date (YYYY-MM-DD format)<br \/>\n8. %T: Time (HH:MM:SS format)<br \/>\n9. %c: Complete date and timestamp (Day-D-M-Y H:M:S format)<\/p>\n<p>After changing the \u201c.bashrc\u201d file, we will get the output shown below when we execute the history command.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/output-after-changing-the-date-and-time-stamps.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111982\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/output-after-changing-the-date-and-time-stamps.webp\" alt=\"output after changing the date and time stamps\" width=\"1073\" height=\"613\" \/><\/a><\/p>\n<h3>Viewing the size of the history buffers<\/h3>\n<p>The \u201c.bashrc\u201d file contains two variables or attributes that control the size of the history buffers, they are:<\/p>\n<ul>\n<li><strong>HISTSIZE: <\/strong>Displays the maximum number of entries for the history list.<\/li>\n<li><strong>HISTFILESIZE: <\/strong>displays the maximum number of entries in the .bash_history file.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/viewing-the-size-of-the-history-buffers.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111983\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/viewing-the-size-of-the-history-buffers.webp\" alt=\"viewing the size of the history buffers\" width=\"1150\" height=\"597\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">If we edit these values, we change <\/span>the way how the Bash shell displays and saves the command history. For<span style=\"font-weight: 400\"> example, changing the HISTSIZE value to 20 <\/span>shows a maximum of<span style=\"font-weight: 400\"> 20 latest entries.<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/setting-histsize-as-20.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111984\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/setting-histsize-as-20.webp\" alt=\"setting histsize as 20\" width=\"1235\" height=\"601\" \/><\/a><\/p>\n<p>After saving the changes in the file by pressing the key combination \u201cCtrl\u201d + \u201cx\u201d and then \u201cy, run the history command, and you will get the following output.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/output-after-changing-histsize-value.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111985\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/output-after-changing-histsize-value.webp\" alt=\"output after changing histsize value\" width=\"1073\" height=\"327\" \/><\/a><\/p>\n<h3>Repeating a command<\/h3>\n<p>If you want to repeat the previous command, you can type 2 exclamation marks on the terminal, as shown below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/repeating-a-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111987\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/repeating-a-command.webp\" alt=\"repeating a command\" width=\"1073\" height=\"208\" \/><\/a><\/p>\n<p>To count from the end of the list, add a negative symbol after the exclamation mark and before the number, as shown below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/counting-from-the-end-of-the-list.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111988\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/counting-from-the-end-of-the-list.webp\" alt=\"counting from the end of the list\" width=\"1073\" height=\"262\" \/><\/a><\/p>\n<h3>Searching a command by a string<\/h3>\n<p>If you want to search for a command that you have previously by its name, you specify its name preceding it with an exclamation mark as shown:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/searching-a-command-by-a-string.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111989\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/searching-a-command-by-a-string.webp\" alt=\"searching a command by a string\" width=\"1187\" height=\"169\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">If you notice carefully, using this method runs the latest command with that string in it. However, if you don\u2019t want to run it and only want to see the command, followed by a \u201c:p\u201d as shown:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">!&lt;name&gt;:p<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/only-viewing-and-not-running-the-previous-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111990\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/only-viewing-and-not-running-the-previous-command.webp\" alt=\"only viewing and not running the previous command\" width=\"1073\" height=\"111\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">If you want a more robust method of searching your command history, pipe it with the grep command followed by the string you wish to search for, as shown:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history | grep &lt;string&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/searching-a-previous-command-using-the-grep-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111991\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/searching-a-previous-command-using-the-grep-command.webp\" alt=\"searching a previous command using the grep command\" width=\"1074\" height=\"252\" \/><\/a><\/p>\n<h3>Changing the executed command<\/h3>\n<p><span style=\"font-weight: 400\">Let us say that I have run the command \u201csudo ufw allow 20\/tcp\u201d to enable port 20, as shown below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/changing-the-executed-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111992\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/changing-the-executed-command.webp\" alt=\"changing the executed command\" width=\"1072\" height=\"150\" \/><\/a><\/p>\n<p>Now, if I want to activate port 21, and given that I am lazy, instead of typing the entire command again and changing 20 to 21, I will use the command \u201c^20^22^\u201d. Voila! I just executed a 5-string command by using just one string.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/changing-the-executed-command-1.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111993\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/changing-the-executed-command-1.webp\" alt=\"changing the executed command\" width=\"1072\" height=\"150\" \/><\/a><\/p>\n<h3>Prevent recording commands in the history<\/h3>\n<p>If you want to prevent the recording of commands in the history list, you can use the command shown below to disable the recording temporarily:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">set +o history<\/pre>\n<p>If you want to re-enable the recording of commands in the history list, use the command shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">set -o history<\/pre>\n<h3>Deleting history<\/h3>\n<p>If you want to clear the entire history list, you can pair the history command with the option \u201c-c\u201d as shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history -c<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/deleting-history.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111994\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/deleting-history.webp\" alt=\"deleting history\" width=\"1073\" height=\"609\" \/><\/a><\/p>\n<p>However, if you want to delete only a specific command, execute the history command by combining it with the option \u201c-d\u201d followed by the number as shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history -d &lt;number&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/deleting-only-a-specific-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111995\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/deleting-only-a-specific-command.webp\" alt=\"deleting only a specific command\" width=\"1073\" height=\"425\" \/><\/a><\/p>\n<h3><strong>Updating the history file<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">As we have seen before, <\/span>the bash shell saves any updates we do to the command history list when you exit the current terminal session. Nevertheless, the history command also allows you to save changes. To do so, simply pair it <span style=\"font-weight: 400\">with the option \u201c-a\u201d as shown:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history -a<\/pre>\n<h3>Summary<\/h3>\n<p>As you have seen, the history command lets you view the commands you executed previously in the terminal. You have now understood what the history command is, why we use it, the syntax of the history command, and the options used along with it. We have also seen a lot of examples where we tinkered with the output of the history command, executed previous commands, searched previously executed commands, how to delta the history, and a lot more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn everything about the history command in Linux. First, we will look at what the history command is, why it is used, and understand the output of the history&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":111976,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[27223],"class_list":["post-111936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-history-command-in-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>History Command in Linux - DataFlair<\/title>\n<meta name=\"description\" content=\"Linux history command lets you view the commands you executed previously in the terminal. See its syntax, output and options with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"History Command in Linux - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Linux history command lets you view the commands you executed previously in the terminal. See its syntax, output and options with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-10T03:30:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-10T03:58:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/history-command-in-linux.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"History Command in Linux - DataFlair","description":"Linux history command lets you view the commands you executed previously in the terminal. See its syntax, output and options with examples.","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:\/\/data-flair.training\/blogs\/history-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"History Command in Linux - DataFlair","og_description":"Linux history command lets you view the commands you executed previously in the terminal. See its syntax, output and options with examples.","og_url":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-02-10T03:30:02+00:00","article_modified_time":"2023-02-10T03:58:12+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/history-command-in-linux.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"History Command in Linux","datePublished":"2023-02-10T03:30:02+00:00","dateModified":"2023-02-10T03:58:12+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/"},"wordCount":1367,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/history-command-in-linux.webp","keywords":["History Command in Linux"],"articleSection":["Linux Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/","url":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/","name":"History Command in Linux - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/history-command-in-linux.webp","datePublished":"2023-02-10T03:30:02+00:00","dateModified":"2023-02-10T03:58:12+00:00","description":"Linux history command lets you view the commands you executed previously in the terminal. See its syntax, output and options with examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/history-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/history-command-in-linux.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/02\/history-command-in-linux.webp","width":1200,"height":628,"caption":"history command in linux"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/history-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Linux Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"History Command in Linux"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=111936"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111936\/revisions"}],"predecessor-version":[{"id":111996,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111936\/revisions\/111996"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/111976"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=111936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=111936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=111936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}