Monday, 4 April 2011

OSX - Command Line History

If you’re like me you run a few commands from the Terminal, and trying to remember an exact command you executed can be hard.

Well, you can query your command line history to find previous commands by using the following syntax:

    history |grep "search string"

A curious aspect is that bash remembers this query as well, so you never get a null result, even a rubbish search gives you itself:

    $ history | grep "fjkskjfvkjf"
    140 history | grep "fjkskjfvkjf"

No comments:

Post a Comment