Searching Your Command History
When developing on a mac or linux you will likely need to run commands in the terminal, whether that be in terminal, your integrated terminal in your IDE or your putty connection.
If you want to run a previous command you can use the arrow keys to traverse the history. This will search the history file corresponding to the shell you are using. If you know part of the command you want to run you can type ‘ctrl + r’ to pull up the reverse command search.
Lets say you were looking up how to create a react app using typescript, and you remember that the command had ’typescript’, but could not remember the rest of the command. So you press ‘ctrl + r’ to open the ‘bck-i-search’ and type ’typescript’.
josh at joshjohansen 🌲 npx create-react-app typescript-react-example --template typescript
bck-i-search: typescript_
You can repeat pressing ctrl + r to continue searching further back through the history. Once you find the command you can press enter to run it.
You can exit the search by pressing ‘ctrl + c’ two times.
This has become essential in how I work and look for commands that have been run before.
May you find what you are looking for.