I’m probably late to the party on this one.
I was working with someone the other day on a problem over a video call and sharing my screen on a Linux box.
They watched as I did what I do often and Grep’ed through my command history to find a command I’d run before but couldn’t remember the specifics of off the top of my head.
Something like this:
Then the person I was working with told me to try pressing Control + R and typing the start of what I was looking for.
My head exploded.
From here you can search through your command history and scroll between matching entries,
I cannot believe it’s taken me this long to learn!
Want more?
You can also get the weekly posts on the blog by Connecting on LinkedIn, following me on Twitter, or Subscribing via RSS.
Nice to know! I always modify /etc/inputrc and uncomment the bindings for PgUp/PgDown keys to search through the history, based on what is on the command line and where the cursor is. E.g. If I out “apt in” and press PgUp it will cycle through all the apt install commands I’ve previously entered.
I was just looking at how to store history across multiple screens and sessions. This fits in nicely, I had not seen it before
https://eli.thegreenplace.net/2016/persistent-history-in-bash-redux/
Wow,! I have been using Linux since kernel version 0.98 and had no clue about ctl+r. Always something new to learn. thank you Nick, keep up the amazing work.