[plug] Anyone got bash tips for an old korn shell user?

Colin Muller colin at twobluedots.com.au
Wed Sep 4 20:43:59 WST 2002


> So can anyone point me to a tutorial (or even just tell me) that will
> explain how to find a previous command (let's say, a mount command),
> scroll through all previous mount commands to find the one I want, edit
> it to what I want now, and not have it execute until I press enter?  It
> shouldn't be hard, I keep hearing how easy bash is to use...

Ctrl-r

Then type what you're after, like mount

If the first one which appears is not right, type Ctrl-r repeatedly to
scroll through previous commands which also contained the characters
you typed.

Then press enter to execute the command, or:
When you get to a previous command you want to edit, type an editing
key sequence and you'll be dropped to the command line with that
editing command already performed, ready to edit the line further,
e.g:
Ctrl-a - go to start of line
Ctrl-e - go to end of line
Ctrl-d - delete character under the cursor
Alt-b - back a word
Ctrl-c - drop to empty command line (the one you were on from Ctrl-r
will be placed on the line above the prompt)

etc etc. Searching google for ctrl-r bash will get you some tips pages
for these key sequences.

Oddly, there doesn't seem to be a way to scroll forwards again if you
go one too far back with Ctrl-r; or maybe I'm just showing my
ignorance there.

Colin



More information about the plug mailing list