Sunday, 14 August 2011

QuickBits-5: Searching for previous commands

How to search and run the same command in bash ?

1. Up / down arrow keys [ good for previous few commands ]

2. Type ctrl+r and type any part of the command including its arguments. Bash will find and run it for you. Keep pressing ctrl+r until u find the right command.

Say you have run the following command sometime back

cd /myfolder/personal/secret/

you can search by typing ctrl+r and typing secret. Bash will find this command for you.

No comments:

Post a Comment