Command history seems to be missing the first 75 lines
First of all, If you need to get a backup of your command line history, then just copy this file:
~/.bash_history
Remember that you have to close all your terminals or run history -a
to append all commands from those history sessions to the history file.
If not, is there any way that I can see lines 1 to 75?
Every command that has been saved in your history is available at ~/.bash_history
file, to see all of them open a terminal and run:
cat ~/.bash_history
To get an output similar to history
command with numbering run:
cat -n ~/.bash_history
Do the line numbers just start at 76 for some reason?
Run this command:
grep "^HIST" .bashrc
You have to get an output similar to:
HISTSIZE=1000
HISTFILESIZE=2000
As I said before ~/.bash_history
keeps command-line's history.
The
HISTFILESIZE
show how many command should~/.bash_history
keeps track of, for mine it's 2000.And
HISTSIZE
is the number of commands thathistory
command (shell built-in actually) keeps track of.
When you open a terminal and run history
, it will picks the last HISTSIZE
number of commands from ~/.bash_history
and shows that to you.
If you run new commands it will remove the older ones from session and append the new ones at the end of its list so the number of commands will match HISTSIZE
.
I guess while asking the question you had 74 command more than of HISTSIZE
in your .bash_history
and that's the reason why it starts at 75.
From man bash
:
-
HISTSIZE
The number of commands to remember in the command history.
-
HISTFILESIZE
The maximum number of lines contained in the history file.