<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=History</id>
	<title>History - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=History"/>
	<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=History&amp;action=history"/>
	<updated>2026-04-27T10:27:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=History&amp;diff=90&amp;oldid=prev</id>
		<title>Ardika Sulistija: Created page with &quot;&lt;b&gt;history&lt;/b&gt; - This commands stores the executed commands ran by a user.   Typically, these commands are store in the user&#039;s home directory: &lt;b&gt;/home/&lt;user&gt;/.bash_history&lt;/b&gt;   For &lt;b&gt;root&lt;/b&gt; user, it will be in: &lt;b&gt;/root/.bash_history&lt;/b&gt;  You can search where the .bash_history file is by running:  $ echo $HISTFILE  /home/ec2-user/.bash_history    # Run as root  $ echo $HISTFILE  /root/.bash_history   ====How to Increase the History Size==== ----  First, check curren...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=History&amp;diff=90&amp;oldid=prev"/>
		<updated>2024-08-27T00:21:04Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;b&amp;gt;history&amp;lt;/b&amp;gt; - This commands stores the executed commands ran by a user.   Typically, these commands are store in the user&amp;#039;s home directory: &amp;lt;b&amp;gt;/home/&amp;lt;user&amp;gt;/.bash_history&amp;lt;/b&amp;gt;   For &amp;lt;b&amp;gt;root&amp;lt;/b&amp;gt; user, it will be in: &amp;lt;b&amp;gt;/root/.bash_history&amp;lt;/b&amp;gt;  You can search where the .bash_history file is by running:  $ echo $HISTFILE  /home/ec2-user/.bash_history    # Run as root  $ echo $HISTFILE  /root/.bash_history   ====How to Increase the History Size==== ----  First, check curren...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;b&amp;gt;history&amp;lt;/b&amp;gt; - This commands stores the executed commands ran by a user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Typically, these commands are store in the user&amp;#039;s home directory: &amp;lt;b&amp;gt;/home/&amp;lt;user&amp;gt;/.bash_history&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;b&amp;gt;root&amp;lt;/b&amp;gt; user, it will be in: &amp;lt;b&amp;gt;/root/.bash_history&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can search where the .bash_history file is by running:&lt;br /&gt;
 $ echo $HISTFILE&lt;br /&gt;
 /home/ec2-user/.bash_history&lt;br /&gt;
 &lt;br /&gt;
 # Run as root&lt;br /&gt;
 $ echo $HISTFILE&lt;br /&gt;
 /root/.bash_history&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to Increase the History Size====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
First, check current settings:&lt;br /&gt;
 $ echo $HISTSIZE&lt;br /&gt;
 1000&lt;br /&gt;
 &lt;br /&gt;
 $ echo $HISTFILESIZE&lt;br /&gt;
 1000&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;HISTSIZE&amp;lt;/b&amp;gt; - The number of commands to remember in the command history (see HISTORY below). If the value is 0, commands are not saved in the history list. Numeric values less than zero result in every command being saved on the history list (there is no limit). The shell sets the default value to 500 after reading any startup files.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;HISTFILESIZE&amp;lt;/b&amp;gt; - The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is trun‐ cated, if necessary, to contain no more than that number of lines by removing the oldest entries. The history file is also truncated to this size after writing it when a shell exits. If the value is 0, the history file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation. The shell sets the default value to the value of HISTSIZE after reading any startup files.&lt;br /&gt;
&lt;br /&gt;
Next, to change those limits, edit ~/.bashrc file and add:&lt;br /&gt;
 $ sudo vim ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
 # Add these lines at the bottom&lt;br /&gt;
 HISTSIZE=10000&lt;br /&gt;
 HISTFILESIZE=10000&lt;br /&gt;
&lt;br /&gt;
 # If you want unlimited history:&lt;br /&gt;
 HISTSIZE=&lt;br /&gt;
 HISTFILESIZE=&lt;br /&gt;
&lt;br /&gt;
Lastly, apply changes:&lt;br /&gt;
 $ source ~/.bashrc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE**&amp;lt;/b&amp;gt; The commands will be stored in .bash_history once the SSH session has ended or when the user exits from the shell. I notice it updates with the command history once I log back into the server and check .bash_history.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Amazon Linux Specifics====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In Amazon Linux 2 AMIs, there is no &amp;lt;b&amp;gt;.bash_history&amp;lt;/b&amp;gt; file even though the &amp;lt;b&amp;gt;history&amp;lt;/b&amp;gt; command will still store the commands. You can simply create the &amp;lt;b&amp;gt;.bash_history&amp;lt;/b&amp;gt;. And then in your &amp;lt;b&amp;gt;.bashrc&amp;lt;/b&amp;gt; file, you must add these lines:&lt;br /&gt;
&lt;br /&gt;
For example, in &amp;lt;b&amp;gt;.bashrc&amp;lt;/b&amp;gt; file, you can add:&lt;br /&gt;
 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)&lt;br /&gt;
 HISTSIZE=1000&lt;br /&gt;
 HISTFILESIZE=2000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to view history with time stamp====&lt;br /&gt;
---- &lt;br /&gt;
&lt;br /&gt;
https://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
&amp;lt;/br&amp;gt;* https://unix.stackexchange.com/questions/286300/sometimes-history-commands-are-not-stored-in-bash-history&lt;br /&gt;
* https://www.thegeekdiary.com/how-to-change-the-number-of-commands-stored-in-bash-history/&lt;br /&gt;
* https://stackoverflow.com/questions/9457233/unlimited-bash-history&lt;br /&gt;
* https://eshlox.net/2017/08/01/bash-increase-command-history-size&lt;/div&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
</feed>