A Linux terminal running Bash has a built-in history that you can use to track what you’ve been doing lately. To view a history of your Bash session, use the built-in command **history**:

$ echo "foo"
foo
$ echo "bar"
bar
$ history
  1  echo "foo"
  2  echo "bar"
  3  history

The **history** command isn’t an executable file on your filesystem, like most commands, but a function of Bash. You can verify this by using the **type** command:

$ type history
history is a shell builtin

History control

The upper limit of lines in your shell history is defined by the **HISTSIZE** variable. You can set this variable in your **.bashrc** file. The following sets your history to 3,000 lines, after which the oldest line is removed to make room for the newest command, placed at the bottom of the list:

export HISTSIZE=3000

There are other history-related variables, too. The **HISTCONTROL** variable controls what history is stored. You can force Bash to exclude commands starting with empty space by placing this in your **.bashrc** file:

export HISTCONTROL=$HISTCONTROL:ignorespace

#bash #bashrc #histsize

Make Bash history more useful with these tips
1.15 GEEK