For examples, I have typed 4 commands in the command prompt:
ls -la
rm -rf /home/user1
du -k /home
find . -name "abc.out" -print
And now I want to retrieve the command which begin with letter "r" (i.e. rm -rf /home/user1), what can I do?
For examples, I have typed 4 commands in the command prompt:
ls -la
rm -rf /home/user1
du -k /home
find . -name "abc.out" -print
And now I want to retrieve the command which begin with letter "r" (i.e. rm -rf /home/user1), what can I do?
with bash : ctrl-r
thx,
How about korn shell?
first do a "set -o vi"
then press ESC
type /r then ENTER
it will give you the last command typed starting with "r"
if you don't want that command then type "k" it will give you the second last command starting with "r" .....and so on...
The point is even at the command line it behaves as if you opened a file and looking for a someting starting with "r"
Hope this helps,
Jingi
once you have your shell edit set to vi
Press Esc and you can browse all commands with j and k keys.
it is like you moving cursor one line up and down in vi.
the easiest way is type an ! followed by the letter(s) of the command you want to use
say you have typed the following in your command prompt
ls -la
rm -rf /home/user1
du -k /home
find . -name "abc.out" -print
if you want to repeat the du
type
!d
if you want to do the ls
type
!l
Its an easy fast way to do just do the last thing you did again
I am not sure for how many commands it will work probably it gets it from
your history.