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

Flavia Bastos on December 21, 2018

Recently I needed to repeat a series of long~ish commands in the command line but I never quite memorized them so I ended up resourcing to arrow-... [Read Full]
markdown guide
 

There’s a good alternative too. If you remember part of the command, by typing ctrl + r and writing that part, it’ll autocomplete it. For example, if you remember it was something like ssh userX@IP but don’t remember the IP address, the command will search in your history and autocomplete it for you ☺️

 

I didn't know this! Thank you so much for sharing!

 

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 :)

 

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

 

Nice trick! I didn't know about the history command, thanks for sharing!

 
code of conduct - report abuse