If you're like me and use the Terminal in OS X on a daily basis, you probably also use the 'history' command quite regularly too. Every time I use history I always pipe it through grep, so always, always end up typing 'history|grep blah', now isn't there an easier way? Well there is, and that's what the alias functionality is for.
I used the alias command in my ~/.profile
file to set up a new command alias called 'ghist' that will run the output of history through grep, this is set up like so:
With that set, all I have to do now is type 'ghist blah' to look through my history for anything I ran that included the text blah
in it. Simple really and quite useful.
Of course this same trick will work in pretty much any other flavour of Unix.
Please leave your comments or feedback below!
Other posts you may like...