DEV Community

Discussion on: Check which commands you typed in the command line and don’t repeat yourself!

Collapse
 
incognitjoe profile image
Joe Butler

Typing history in the command line will list all the recent typed commands (I’m not sure how far it goes…)

You can control that by setting the HISTSIZE environment variable in your ~/.bashrc. export HISTSIZE=2000 would remember the last 2000 commands. Also note your history isn't automatically written after every command - your .bash_history is updated when the shell exits, if you want to definitely persist whatever you've just done you can force an update with history -a.

Also, minor note of caution, if you're typing passwords or other sensitive info into your shell, they'll go in the history file too :)

Collapse
 
flaviabastos profile image
Flávia Bastos

wow, thank you so much for this extra info. This is great!