Pages

Wednesday, April 2, 2014

define a function "hg" combining history and grep to save typing

$ function hg () { history | grep $* ; } # define a function combining history and grep to save typing :-)

By defining a function "hg" as shown here, it saves me typing "history | grep" every time I need to search my shell history because now I only have to type "hg".


A nifty time saver :-)


You can also add the "hg" function definition to your .bashrc so it is defined each time you login.




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/PiD1ik

No comments:

Post a Comment