bash tip: what was that command?

Can’t remember that great command you used a couple days ago?

Try this:
ian@linux:~# history | grep "command"

Substitute “command” with any part of it you still remember. You’ll get a list of everything in your command history that includes that bit of text, and the command you’re looking for should be in there somewhere.

If I run `history | grep tee', I get:

1837 man tee
2383 history | grep tee

Then I can run `man tee' again by typing `!1837'


No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: