sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)
Sophie ([personal profile] sophie) wrote in [community profile] command_liners2010-08-03 10:35 pm
Entry tags:

bash history search

A quick tip for bash users that I use all the time:

If you have a command in your history that you want to re-execute or edit, but don't want to keep tapping the up key, hit Ctrl-R and then start typing part of the line. bash will find the last line matching your input on the fly. If it's not the one you want, either keep typing until it is, or hit Ctrl-R and bash will show you the next match.

Once you've got it, you have two options: to execute, you can then just press RETURN; to edit, use a movement key (left/right arrows, Home/End, etc) and bash will drop you back to a standard command line with the line you just found.

This trick also works if you know the middle of the line but not the beginning, since bash searches the entire line.

[edited to add: BTW, Fey, do you realise that nobody can add new tags to posts in this community? The only tags in here are ones first used by you. :)]

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting