In Bash shell, the following three variables help in configuring the history command
Run the following command
set -o | grep history
The output of the above command shall be either history off or history on
Eg: $ set -o | grep history
history on
How to enable history for a user?
If set -o | grep history provides the output as history off, then history can be enabled for the user as follows
1) Add the follow line in the file ~/.bashrc
set -o history
2) Then check the values of the parameters - HISTFILE, HISTSIZE, HISTFILESIZE
echo $HISTFILE
echo $HISTSIZE
echo $HISTFILESIZE
If the value of echo $HISTFILE is blank or /dev/null, add the following line in ~/.bashrc file
HISTFILE=$HOME/.bash_history
If HISTSIZE or HISTFILESIZE is set to 0, set it to a value of choice in ~/.bashrc file
HISTFILESIZE=1000
HISTSIZE=1000
- HISTFILE - Where the history of the exited shell is stored
- HISTFILESIZE - How many entries are stored there
- HISTSIZE - How many entries are kept in the memory while using the shell.
Run the following command
set -o | grep history
The output of the above command shall be either history off or history on
Eg: $ set -o | grep history
history on
How to enable history for a user?
If set -o | grep history provides the output as history off, then history can be enabled for the user as follows
1) Add the follow line in the file ~/.bashrc
set -o history
2) Then check the values of the parameters - HISTFILE, HISTSIZE, HISTFILESIZE
echo $HISTFILE
echo $HISTSIZE
echo $HISTFILESIZE
If the value of echo $HISTFILE is blank or /dev/null, add the following line in ~/.bashrc file
HISTFILE=$HOME/.bash_history
If HISTSIZE or HISTFILESIZE is set to 0, set it to a value of choice in ~/.bashrc file
HISTFILESIZE=1000
HISTSIZE=1000
No comments:
Post a Comment