Use Last Instance of Terminal Command Search

Last week I went over how to use the last instance of a terminal command from your bash history. This week I want to show another advanced way of using that command. As it turns out, you can also search using the ! prefix. Check out the following command:

This command will find the last command I used that contained the string “Dropbox” in it. As of writing this tutorial, that command was cd Dropbox/Development/Plugins\ WordPress/dobsondev-shortcodes/. I was working on updating my DobsonDev Shortcodes plugin when I used that.

As you can probably already tell – this command will be extremely useful for a lot of different cases. Maybe you used a command a long time ago and you only remember a certain part of it. Maybe you ran an extremely long command with a particular wordlist file and you just want to rerun the command without hitting up a million times. Either way it’s got you covered!

You might have noticed the last two weeks I’ve had very short snippets for my posts. Right now it’s pretty busy at work and I’m doing a lot of summer-y stuff during my off time. The rest of the posts for the summer might also just be little snippets but I still think they’re really useful and they are definitely a less involved read. I might miss a few weeks as well depending on vacations plans and such. Just thought I would let you all know!

As always thank you for reading and please share it around as much as you can! Please feel free to put any suggestions or ideas for future tutorials in the comments section below.