Usually I need to use the same commands again after a few weeks, and forget the exact syntax. That is why I sometimes open .bash_history to search for commands that I used earlier.
In Bash, I open .bash_history in the Azure Cloud Shell editor and use Ctrl + F to search for a keyword, just like in a normal text file.
In PowerShell, search for the history file with:
(Get-PSReadLineOption).HistorySavePath
After opening the file in the editor you can search it in the same way.
It is a simple habit, but it saves time when:
- You need to repeat a command you used before.
- You remember the result, but not the exact syntax.
- You want to reuse a troubleshooting step quickly.
- You want to browse or compare several previous commands.
Bash and PowerShell both support Ctrl + R for quick reverse history search. If I want to browse the complete history, I can open the history file and use Ctrl + F to search it like a normal text file.
For me, it is often easier than trying to rebuild the command from memory.
A small but useful tip if you work with Linux or Azure Cloud Shell from time to time.
