It happens to me almost everyday that I type a long command (combination of commands) and then after executing million other commands I need the long old command back again. What I used to do is hit up and down arrow keys on my key board and keep staring on the screen so that I don't miss the long command. This process is usually very time consuming and frustrating. Today all of a sudden I thought of
grepping the history command and aahaa!!!!
simply grep the history command as under:
# history | grep perl
235 perl -e "s/rakesh/root/g;" -pi $(find . -type f)
267 perl -e "s/rakesh/root/g;" -pi $(find . -type f)
then you can just type
!267 to execute the command or just copy/paste it.
try it and you will save a lot of time for sure.
Thanks
--Rakesh
No comments:
Post a Comment