Home > OS >  How to recover a very old command from history?
How to recover a very old command from history?

Time:09-29

I have used a command for some calculations on 3rd March 2021 within the time range 15:37:00 (input file creation time) to 16:17:00 (output file generating time). Unfortunately, I lost the command (from writing) and can not remember now. Is there any way to get it from history? As history only give last 1000 command which is not getting to that time period. If anyone can help me here will be very beneficial. Thank you in advance.

CodePudding user response:

What do you mean by losing the command? Do you mean that you deleted the commands history? It seems like you are hitting the hard limit set in your env? try to increase it.

echo $HISTSIZE

CodePudding user response:

I mean, I cannot remember the command by myself and can not find any copy of it written anywhere. I have not deleted anything by myself. The machine might have default settings of keeping history for users (I do not know exactly).

As a long time (almost 6 months) has been passed, I can not see it in the command history. $ echo $HISTSIZE 1000 $ history results in the last 1000 commands I have used.

Then, I have tried, $HISTSIZE=15000 $ echo $HISTSIZE 15000 $ history still results in ~1000 commands from history.

Is it possible to get the list of commands I have used on 3rd March 2021?

  • Related