Linux History Size

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

$HISTSIZE

This command helps you to determine the number of commands history in your current environment. By default, in most distributions it is 500 or 1000.

Syntax:

echo $HISTSIZE

Linux History Size1

Look at the above snapshot, our system has 1000 commands in command history.

You can also change the number of commands in command history if you want.

Syntax:

HISTSIZE=<number>

Example:

HISTSIZE=1200 

Linux History Size2

Look at the above snapshot, we have changed the number of commands in our command history.


HISTFILE

This command points to the file that contains your history. Its default value in bash shell is ~/.bash_history.

Syntax:

echo $HISTFILE 

Linux History Size3

Look at the above snapshot, it shows the file containing history.

$HISTFILESIZE

This command helps to set the number of commands kept in your history file.

Syntax:

HISTFILESIZE=<number>

Example:

HISTFILESIZE=2500

Linux History Size4

Look at the above snapshot, we have changed the HISTFILESIZE from 2200 to 2500.